Package org.pgpainless.util
Class CollectionUtils
- java.lang.Object
-
- org.pgpainless.util.CollectionUtils
-
public final class CollectionUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidaddAll(java.util.Iterator<T> iterator, java.util.Collection<T> collection)Add all items from the iterator to the collection.static <T> T[]concat(T t, T[] ts)Return a new array which containsstatic <T> booleancontains(T[] ts, T t)Return true, if the given arraystatic <I> java.util.List<I>iteratorToList(java.util.Iterator<I> iterator)Return all items returned by theIteratoras aList.
-
-
-
Method Detail
-
iteratorToList
public static <I> java.util.List<I> iteratorToList(java.util.Iterator<I> iterator)
Return all items returned by theIteratoras aList.- Type Parameters:
I- type- Parameters:
iterator- iterator- Returns:
- list
-
concat
public static <T> T[] concat(T t, T[] ts)Return a new array which containst
as first element, followed by the elements ofts
.- Type Parameters:
T- type- Parameters:
t- headts- tail- Returns:
- t and ts as array
-
contains
public static <T> boolean contains(T[] ts, T t)Return true, if the given arrayts
contains the elementt
.- Type Parameters:
T- type- Parameters:
ts- elementst- searched element- Returns:
- true if ts contains t, false otherwise
-
addAll
public static <T> void addAll(java.util.Iterator<T> iterator, java.util.Collection<T> collection)Add all items from the iterator to the collection.- Type Parameters:
T- type of item- Parameters:
iterator- iterator to gather items fromcollection- collection to add items to
-
-