Class CollectionUtils
java.lang.Object
org.aksw.commons.collections.CollectionUtils
User: raven
Date: 4/17/11
Time: 12:36 AM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional<T> argmaxInt(Collection<T> xs, ToIntFunction<? super T> score) static <T, C extends Collection<T>>
CnewCollection(Supplier<C> collectionSupplier, Iterable<? extends T> items) Create a new collection and initialize it with items from an iterable Mainly useful in cases where use of guava could cause issues (e.g.static <T, C extends Collection<T>>
CnewCollection(Supplier<C> collectionSupplier, Iterator<? extends T> itemIt) Create a new collection and initialize it with items from an iterator Mainly useful in cases where use of guava could cause issues (e.g.safeGetFirst(Iterable<T> iterable) Given an iterable A whose elements are iterables, this method will return the first element of A.
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
newCollection
public static <T, C extends Collection<T>> C newCollection(Supplier<C> collectionSupplier, Iterator<? extends T> itemIt) Create a new collection and initialize it with items from an iterator Mainly useful in cases where use of guava could cause issues (e.g. hadoop/spark) -
newCollection
public static <T, C extends Collection<T>> C newCollection(Supplier<C> collectionSupplier, Iterable<? extends T> items) Create a new collection and initialize it with items from an iterable Mainly useful in cases where use of guava could cause issues (e.g. hadoop/spark) -
safeGetFirst
Given an iterable A whose elements are iterables, this method will return the first element of A. If no such element exist, an empty iterable is returned rather than null.- Type Parameters:
S-T-- Parameters:
iterable-- Returns:
-
chunk
-
argmaxInt
-