Package org.opends.server.util
Class CollectionUtils
java.lang.Object
org.opends.server.util.CollectionUtils
Utility class for
Collections.-
Method Summary
Modifier and TypeMethodDescriptionstatic <E,C extends Collection<E>>
voidAdds all the elements from the provided iterable into the provided collection.static <C extends Collection<E>,E>
CCollects all the elements from the provided iterable into the provided collection.static <E> ArrayList<E>newArrayList(E... elements) Creates a newArrayListwith the provided elements.static <E> HashSet<E>newHashSet(E... elements) Creates a newHashSetwith the provided elements.static <E> LinkedList<E>newLinkedList(E... elements) Creates a newLinkedListwith the provided elements.static <E> TreeSet<E>newTreeSet(E... elements) Creates a newTreeSetwith the provided elements.
-
Method Details
-
newArrayList
Creates a newArrayListwith the provided elements.- Type Parameters:
E- the elements' type- Parameters:
elements- the elements to add to the new ArrayList- Returns:
- a new ArrayList with the provided elements
-
newLinkedList
Creates a newLinkedListwith the provided elements.- Type Parameters:
E- the elements' type- Parameters:
elements- the elements to add to the new LinkedList- Returns:
- a new LinkedList with the provided elements
-
newHashSet
Creates a newHashSetwith the provided elements.- Type Parameters:
E- the elements' type- Parameters:
elements- the elements to add to the new HashSet- Returns:
- a new HashSet with the provided elements
-
newTreeSet
Creates a newTreeSetwith the provided elements.- Type Parameters:
E- the elements' type- Parameters:
elements- the elements to add to the new TreeSet- Returns:
- a new TreeSet with the provided elements
-
collect
Collects all the elements from the provided iterable into the provided collection.- Type Parameters:
C- The type of the collectionE- The type of the iterable's elements- Parameters:
iterable- the iterable from which to read elementsoutputCollection- the collection where to add the iterable's elements- Returns:
- the provided collection
-
addAll
Adds all the elements from the provided iterable into the provided collection.- Type Parameters:
E- type of the elements to addC- type of the collection where to add- Parameters:
dest- the collection where elements will be addedsource- the iterable where elements will be read from
-