public final class CollectionUtils extends Object
Collection
s.Modifier and Type | Method and Description |
---|---|
static <E,C extends Collection<E>> |
addAll(C dest,
Iterable<E> source)
Adds all the elements from the provided iterable into the provided collection.
|
static <C extends Collection<E>,E> |
collect(Iterable<E> iterable,
C outputCollection)
Collects all the elements from the provided iterable into the provided collection.
|
static boolean |
isEmpty(Iterable<?> iterable)
Returns whether the provided iterable is empty, i.e.
|
static <E> ArrayList<E> |
newArrayList(E... elements)
Creates a new
ArrayList with the provided elements. |
static <E> HashSet<E> |
newHashSet(E... elements)
Creates a new
HashSet with the provided elements. |
static <E> LinkedHashSet<E> |
newLinkedHashSet(E... elements)
Creates a new
LinkedHashSet with the provided elements. |
static <E> LinkedList<E> |
newLinkedList(E... elements)
Creates a new
LinkedList with the provided elements. |
static <E> TreeSet<E> |
newTreeSet(E... elements)
Creates a new
TreeSet with the provided elements. |
@SafeVarargs public static <E> ArrayList<E> newArrayList(E... elements)
ArrayList
with the provided elements.E
- the elements' typeelements
- the elements to add to the new ArrayList@SafeVarargs public static <E> LinkedList<E> newLinkedList(E... elements)
LinkedList
with the provided elements.E
- the elements' typeelements
- the elements to add to the new LinkedList@SafeVarargs public static <E> HashSet<E> newHashSet(E... elements)
HashSet
with the provided elements.E
- the elements' typeelements
- the elements to add to the new HashSet@SafeVarargs public static <E> LinkedHashSet<E> newLinkedHashSet(E... elements)
LinkedHashSet
with the provided elements.E
- the elements' typeelements
- the elements to add to the new LinkedHashSet@SafeVarargs public static <E> TreeSet<E> newTreeSet(E... elements)
TreeSet
with the provided elements.E
- the elements' typeelements
- the elements to add to the new TreeSetpublic static <C extends Collection<E>,E> C collect(Iterable<E> iterable, C outputCollection)
C
- The type of the collectionE
- The type of the iterable's elementsiterable
- the iterable from which to read elementsoutputCollection
- the collection where to add the iterable's elementspublic static boolean isEmpty(Iterable<?> iterable)
iterable
- the iterable for which to omake the determinationtrue
if the iterable is empty, false
otherwise.public static <E,C extends Collection<E>> C addAll(C dest, Iterable<E> source)
E
- type of the elements to addC
- type of the collection where to adddest
- the collection where elements will be addedsource
- the iterable where elements will be read fromCopyright 2010-2018 ForgeRock AS.