public final class CollectionsUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectionsUtil.IteratorToEnumeration<T>
Convert an iterator to an enumeration.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
addAll(Collection<T> col,
Enumeration<T> e)
Add all elements of the given enumeration into the given collection.
|
static <T> void |
addAll(Collection<T> col,
Iterator<T> it)
Add all elements of the given iterator into the given collection.
|
static boolean |
containsInstance(Collection<?> col,
Object instance)
Return true if the collection contains the instance.
|
static <T> Enumeration<T> |
enumeration(Iterator<T> iterator)
Instantiate an IteratorToEnumeration on the given iterator.
|
static boolean |
equals(List<?> list1,
List<?> list2)
Return true of the 2 lists are identical.
|
static <T> Function<Collection<T>,T> |
filterSingle(Predicate<T> predicate)
Return a function that search an element and return it, ot null if not found.
|
static <T> T |
findElement(Collection<T> collection,
Predicate<T> predicate)
Search an element and return it, ot null if not found.
|
static <T> Iterable<T> |
iterable(Enumeration<T> enumeration)
Create an Iterable from the enumeration, by filling a LinkedList with the elements in the enumeration.
|
static <T> Iterator<T> |
iterator(Enumeration<T> enumeration)
Create an Iterator from an Enumeration.
|
static <Input,Output> |
map(List<Input> inputs,
Function<Input,Output> mapper)
Convert a list of Input into a list of Output using the given mapper.
|
static <T> Iterable<T> |
singleTimeIterable(Enumeration<T> enumeration)
Create an Iterable from an Enumeration, but avoiding to create a list, so the Iterable can be iterated only once.
|
public static <T> Enumeration<T> enumeration(Iterator<T> iterator)
public static <T> Iterable<T> iterable(Enumeration<T> enumeration)
public static <T> Iterator<T> iterator(Enumeration<T> enumeration)
public static <T> Iterable<T> singleTimeIterable(Enumeration<T> enumeration)
public static boolean equals(List<?> list1, List<?> list2)
ObjectUtil.equalsOrNull(Object, Object) is used.public static <T> void addAll(Collection<T> col, Enumeration<T> e)
public static <T> void addAll(Collection<T> col, Iterator<T> it)
public static boolean containsInstance(Collection<?> col, Object instance)
public static <Input,Output> List<Output> map(List<Input> inputs, Function<Input,Output> mapper)
public static <T> T findElement(Collection<T> collection, Predicate<T> predicate)
public static <T> Function<Collection<T>,T> filterSingle(Predicate<T> predicate)
Copyright © 2019. All rights reserved.