Package jenkins.scm.impl.form
Class NamedArrayList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
jenkins.scm.impl.form.NamedArrayList<E>
- Type Parameters:
E- the type of element.
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,RandomAccess
An
ArrayList that also has an associated name for use with the FormTagLib.traits() tag.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRepresents a predicate (boolean-valued function) of one argument. -
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionNamedArrayList(String name, E... elements) Copy constructor.NamedArrayList(String name, Collection<? extends E> c) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> NamedArrayList.Predicate<E>allOf(NamedArrayList.Predicate<? super E>... predicates) CombinesNamedArrayList.Predicateinstances using a boolean short-circuit logical AND.static <E> NamedArrayList.Predicate<E>anyOf(NamedArrayList.Predicate<E>... predicates) CombinesNamedArrayList.Predicateinstances using a boolean short-circuit logical OR.final StringgetName()Gets the associate name.static <E> voidselect(List<? extends E> source, String name, NamedArrayList.Predicate<? super E> selector, boolean removeSelectedFromSource, List<NamedArrayList<? extends E>> destination) Helper method that creates a newNamedArrayListby selecting matching elements from a source list and appends the newNamedArrayListto a list ofNamedArrayList.static <E> voidselect(List<? extends E> source, String name, NamedArrayList.Predicate<? super E> selector, boolean removeSelectedFromSource, List<NamedArrayList<? extends E>> destination, int index) Helper method that creates a newNamedArrayListby selecting matching elements from a source list and appends the newNamedArrayListto a list ofNamedArrayList.static <A extends Annotation>
NamedArrayList.Predicate<Object>withAnnotation(Class<A> annotation) Returns aNamedArrayList.Predicatethat checks if the object class has been annotated with the supplied annotation.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
NamedArrayList
Copy constructor.- Parameters:
name- the name.c- the collection whose elements are to be placed into this list
-
NamedArrayList
Copy constructor.- Parameters:
name- the name.elements- the initial elements.
-
-
Method Details
-
getName
Gets the associate name.- Returns:
- the associate name.
-
select
public static <E> void select(@NonNull List<? extends E> source, @NonNull String name, @CheckForNull NamedArrayList.Predicate<? super E> selector, boolean removeSelectedFromSource, @NonNull List<NamedArrayList<? extends E>> destination) Helper method that creates a newNamedArrayListby selecting matching elements from a source list and appends the newNamedArrayListto a list ofNamedArrayList.- Type Parameters:
E- the type of element.- Parameters:
source- the list of candidate elements.name- the name.selector- the (optional) selection criteria (ifnullthen all candidate elements will be added)removeSelectedFromSource- iftruethen the matching elements will be removed from the source.destination- theListofNamedArrayListto add to (empty selections will not be added)
-
select
public static <E> void select(@NonNull List<? extends E> source, @NonNull String name, @CheckForNull NamedArrayList.Predicate<? super E> selector, boolean removeSelectedFromSource, @NonNull List<NamedArrayList<? extends E>> destination, int index) Helper method that creates a newNamedArrayListby selecting matching elements from a source list and appends the newNamedArrayListto a list ofNamedArrayList.- Type Parameters:
E- the type of element.- Parameters:
source- the list of candidate elements.name- the name.selector- the (optional) selection criteria (ifnullthen all candidate elements will be added)removeSelectedFromSource- iftruethen the matching elements will be removed from the source.destination- theListofNamedArrayListto add to (empty selections will not be added)index- index at which the specified selection is to be inserted (will be coerced into the valid range to remove the risk ofIndexOutOfBoundsException).
-
allOf
public static <E> NamedArrayList.Predicate<E> allOf(NamedArrayList.Predicate<? super E>... predicates) CombinesNamedArrayList.Predicateinstances using a boolean short-circuit logical AND.- Type Parameters:
E- type.- Parameters:
predicates- the predicates to combine.- Returns:
- a composite predicate.
-
anyOf
CombinesNamedArrayList.Predicateinstances using a boolean short-circuit logical OR.- Type Parameters:
E- type.- Parameters:
predicates- the predicates to combine.- Returns:
- a composite predicate.
-
withAnnotation
public static <A extends Annotation> NamedArrayList.Predicate<Object> withAnnotation(Class<A> annotation) Returns aNamedArrayList.Predicatethat checks if the object class has been annotated with the supplied annotation.- Type Parameters:
A- the type of annotation.- Parameters:
annotation- the annotation to check.- Returns:
- the predicate.
-