public final class CollectionUtils extends Object
Collection
s.Modifier and Type | Method and Description |
---|---|
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. |
public static <E> ArrayList<E> newArrayList(E... elements)
ArrayList
with the provided elements.E
- the elements' typeelements
- the elements to add to the new ArrayListpublic static <E> LinkedList<E> newLinkedList(E... elements)
LinkedList
with the provided elements.E
- the elements' typeelements
- the elements to add to the new LinkedListpublic static <E> HashSet<E> newHashSet(E... elements)
HashSet
with the provided elements.E
- the elements' typeelements
- the elements to add to the new HashSetpublic static <E> LinkedHashSet<E> newLinkedHashSet(E... elements)
LinkedHashSet
with the provided elements.E
- the elements' typeelements
- the elements to add to the new LinkedHashSetpublic 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 elementsCopyright © 2010-2017 ForgeRock AS. All Rights Reserved.