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
Modifier and TypeClassDescriptionstatic interface
Represents a predicate (boolean-valued function) of one argument. -
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionNamedArrayList
(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.Predicate
instances using a boolean short-circuit logical AND.static <E> NamedArrayList.Predicate<E>
anyOf
(NamedArrayList.Predicate<E>... predicates) CombinesNamedArrayList.Predicate
instances using a boolean short-circuit logical OR.final String
getName()
Gets the associate name.static <E> void
select
(List<? extends E> source, String name, NamedArrayList.Predicate<? super E> selector, boolean removeSelectedFromSource, List<NamedArrayList<? extends E>> destination) Helper method that creates a newNamedArrayList
by selecting matching elements from a source list and appends the newNamedArrayList
to a list ofNamedArrayList
.static <E> void
select
(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 newNamedArrayList
by selecting matching elements from a source list and appends the newNamedArrayList
to a list ofNamedArrayList
.static <A extends Annotation>
NamedArrayList.Predicate<Object>withAnnotation
(Class<A> annotation) Returns aNamedArrayList.Predicate
that 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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods 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 newNamedArrayList
by selecting matching elements from a source list and appends the newNamedArrayList
to 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 (ifnull
then all candidate elements will be added)removeSelectedFromSource
- iftrue
then the matching elements will be removed from the source.destination
- theList
ofNamedArrayList
to 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 newNamedArrayList
by selecting matching elements from a source list and appends the newNamedArrayList
to 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 (ifnull
then all candidate elements will be added)removeSelectedFromSource
- iftrue
then the matching elements will be removed from the source.destination
- theList
ofNamedArrayList
to 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.Predicate
instances using a boolean short-circuit logical AND.- Type Parameters:
E
- type.- Parameters:
predicates
- the predicates to combine.- Returns:
- a composite predicate.
-
anyOf
CombinesNamedArrayList.Predicate
instances 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.Predicate
that 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.
-