public final class CollectionUtils extends Object
Collections.| 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 elementspublic static boolean isEmpty(Iterable<?> iterable)
iterable - the iterable for which to omake the determinationtrue if the iterable is empty, false otherwise.Copyright © 2010-2020 Wren Security. All Rights Reserved.