|
||||||||||
| 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<Boolean> |
AND
|
static CollectionUtils.Mapper<String,double[]> |
DOUBLE_PRINTER
Use like this: System.out.println(map(List |
| Constructor Summary | |
|---|---|
CollectionUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAllUncontained(Collection<T> col1,
Collection<T> col2)
Adds all elements from col2 to col1, if they're not already contained. |
|
static
|
clearNulls(Collection<T> col)
|
|
static
|
clearNulls(List<T> col)
Removed null elements in-place. |
|
static
|
filter(Collection<T> col,
CollectionUtils.Predicate<T> pred)
|
|
static
|
getArrayPrinter()
|
|
static
|
getInstanceofMapper(Class<?> c)
|
|
static CollectionUtils.Reducer<String> |
getStringJoiner(String delim)
|
|
static
|
map(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,
Collection<T> col,
CollectionUtils.Reducer<T> reducer)
|
|
static
|
removeDuplicates(List<T> list)
Keeps and returns the original list. |
|
static
|
unzip(Collection<Triple<T,U,V>> col)
|
|
static
|
unzip(Map<T,U> map)
|
|
static
|
unzipPair(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<String,double[]> DOUBLE_PRINTER
public static final CollectionUtils.Reducer<Boolean> AND
| Constructor Detail |
|---|
public CollectionUtils()
| Method Detail |
|---|
public static CollectionUtils.Reducer<String> getStringJoiner(String delim)
delim -
public static <T> CollectionUtils.Mapper<String,T[]> getArrayPrinter()
T -
public static <T> CollectionUtils.Mapper<Boolean,T> getInstanceofMapper(Class<?> c)
T - c -
public static <T> List<T> removeDuplicates(List<T> list)
T - list -
public static <T> void addAllUncontained(Collection<T> col1,
Collection<T> col2)
T - col1 - col2 - public static <T,U> Pair<ArrayList<T>,ArrayList<U>> unzipPair(Collection<Pair<T,U>> col)
T - U - col -
public static <T,U,V> Triple<ArrayList<T>,ArrayList<U>,ArrayList<V>> unzip(Collection<Triple<T,U,V>> col)
T - U - V - col -
public static <T,U> Pair<ArrayList<T>,ArrayList<U>> unzip(Map<T,U> map)
T - U - map -
public static <T,U> LinkedList<T> map(U[] col,
CollectionUtils.Mapper<T,U> mapper)
T - U - col - mapper -
public static <T,U> LinkedList<T> map(Collection<U> col,
CollectionUtils.Mapper<T,U> mapper)
T - U - col - mapper -
public static <T> T reduce(T identity,
Collection<T> col,
CollectionUtils.Reducer<T> reducer)
T - identity - col - reducer -
public static <T> ArrayList<T> clearNulls(Collection<T> col)
T - col -
public static <T> void clearNulls(List<T> col)
T - col -
public static <T> List<T> filter(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 | |||||||||