|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.commons.utils.CollectionUtils
public class CollectionUtils
CollectionUtils
| Nested Class Summary | |
|---|---|
static interface |
CollectionUtils.Mapper<T,U>
Mapper gives a name to a simple function. |
static interface |
CollectionUtils.Predicate<T>
|
static interface |
CollectionUtils.Reducer<T>
Reducer |
| Field Summary | |
|---|---|
static CollectionUtils.Reducer<java.lang.Boolean> |
AND
|
static CollectionUtils.Mapper<java.lang.String,double[]> |
DOUBLE_PRINTER
Use like this: System.out.println(map(List |
| Constructor Summary | |
|---|---|
CollectionUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAllUncontained(java.util.Collection<T> col1,
java.util.Collection<T> col2)
Adds all elements from col2 to col1, if they're not already contained. |
|
static
|
clearNulls(java.util.Collection<T> col)
|
|
static
|
clearNulls(java.util.List<T> col)
Removed null elements in-place. |
|
static
|
filter(java.util.Collection<T> col,
CollectionUtils.Predicate<T> pred)
|
|
static
|
getArrayPrinter()
|
|
static
|
getInstanceofMapper(java.lang.Class<?> c)
|
|
static CollectionUtils.Reducer<java.lang.String> |
getStringJoiner(java.lang.String delim)
|
|
static
|
map(java.util.Collection<U> col,
CollectionUtils.Mapper<T,U> mapper)
Wraps a for loop and the creation of a new list. |
|
static
|
map(U[] col,
CollectionUtils.Mapper<T,U> mapper)
Wraps a for loop and the creation of a new list. |
|
static
|
reduce(T identity,
java.util.Collection<T> col,
CollectionUtils.Reducer<T> reducer)
|
|
static
|
removeDuplicates(java.util.List<T> list)
Keeps and returns the original list. |
|
static
|
unzip(java.util.Collection<Triple<T,U,V>> col)
|
|
static
|
unzip(java.util.Map<T,U> map)
|
|
static
|
unzipPair(java.util.Collection<Pair<T,U>> col)
This indirection is useful in case you use ComparablePairs instead of normal ones and want to unzip. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final CollectionUtils.Mapper<java.lang.String,double[]> DOUBLE_PRINTER
public static final CollectionUtils.Reducer<java.lang.Boolean> AND
| Constructor Detail |
|---|
public CollectionUtils()
| Method Detail |
|---|
public static CollectionUtils.Reducer<java.lang.String> getStringJoiner(java.lang.String delim)
delim -
public static <T> CollectionUtils.Mapper<java.lang.String,T[]> getArrayPrinter()
T -
public static <T> CollectionUtils.Mapper<java.lang.Boolean,T> getInstanceofMapper(java.lang.Class<?> c)
T - c -
public static <T> java.util.List<T> removeDuplicates(java.util.List<T> list)
T - list -
public static <T> void addAllUncontained(java.util.Collection<T> col1,
java.util.Collection<T> col2)
T - col1 - col2 - public static <T,U> Pair<java.util.ArrayList<T>,java.util.ArrayList<U>> unzipPair(java.util.Collection<Pair<T,U>> col)
T - U - col -
public static <T,U,V> Triple<java.util.ArrayList<T>,java.util.ArrayList<U>,java.util.ArrayList<V>> unzip(java.util.Collection<Triple<T,U,V>> col)
T - U - V - col -
public static <T,U> Pair<java.util.ArrayList<T>,java.util.ArrayList<U>> unzip(java.util.Map<T,U> map)
T - U - map -
public static <T,U> java.util.LinkedList<T> map(U[] col,
CollectionUtils.Mapper<T,U> mapper)
T - U - col - mapper -
public static <T,U> java.util.LinkedList<T> map(java.util.Collection<U> col,
CollectionUtils.Mapper<T,U> mapper)
T - U - col - mapper -
public static <T> T reduce(T identity,
java.util.Collection<T> col,
CollectionUtils.Reducer<T> reducer)
T - identity - col - reducer -
public static <T> java.util.ArrayList<T> clearNulls(java.util.Collection<T> col)
T - col -
public static <T> void clearNulls(java.util.List<T> col)
T - col -
public static <T> java.util.List<T> filter(java.util.Collection<T> col,
CollectionUtils.Predicate<T> pred)
T - col - pred -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||