|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.gmbal.generic.Algorithms
public final class Algorithms
| Nested Class Summary | |
|---|---|
static interface |
Algorithms.Action<T>
|
| Method Summary | ||
|---|---|---|
static
|
and(Predicate<A> arg1,
Predicate<A> arg2)
|
|
static List |
convertToList(Object arg)
Converts obj from an Array to a List, if obj is an array. |
|
static String |
convertToString(Object arg)
Convert argument to String, either by toString, ot Arrays.toString. |
|
static
|
doPrivileged(Algorithms.Action<T> func)
|
|
static
|
FALSE(Class<T> cls)
|
|
static
|
filter(List<A> arg,
List<A> result,
Predicate<A> predicate)
|
|
static
|
filter(List<A> arg,
Predicate<A> predicate)
|
|
static
|
find(List<A> arg,
Predicate<A> predicate)
|
|
static
|
flatten(List<S> list,
UnaryFunction<S,List<T>> map)
Flatten the results of applying map to list into a list of T. |
|
static
|
fold(List<A> list,
R initial,
BinaryFunction<R,A,R> func)
|
|
static Map<String,Object> |
getAnnotationValues(Annotation ann,
boolean convertArraysToLists)
Given an annotation, return a Map that maps each field (given by a method name) to its value in the annotation. |
|
static
|
getFirst(Collection<T> list,
Runnable handleEmptyList)
Return the first element of the list, or invoke handleEmptyList if list is empty. |
|
static
|
list(T... arg)
|
|
static
|
map(Collection<A> arg,
Collection<R> result,
UnaryFunction<A,R> func)
|
|
static
|
map(List<A> arg,
UnaryFunction<A,R> func)
|
|
static
|
map(Map<K,A> arg,
UnaryFunction<A,R> func)
|
|
static
|
map(Pair<K,V>... pairs)
|
|
static
|
mapToFunction(Map<A,R> map)
|
|
static
|
not(Predicate<A> arg1)
|
|
static
|
or(Predicate<A> arg1,
Predicate<A> arg2)
|
|
static
|
pair(S first,
T second)
|
|
static
|
TRUE(Class<T> cls)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> List<T> list(T... arg)
public static <S,T> Pair<S,T> pair(S first,
T second)
public static <K,V> Map<K,V> map(Pair<K,V>... pairs)
public static <A,R> UnaryFunction<A,R> mapToFunction(Map<A,R> map)
public static <A,R> void map(Collection<A> arg,
Collection<R> result,
UnaryFunction<A,R> func)
public static <K,A,R> Map<K,R> map(Map<K,A> arg,
UnaryFunction<A,R> func)
public static <A,R> List<R> map(List<A> arg,
UnaryFunction<A,R> func)
public static <A> Predicate<A> and(Predicate<A> arg1,
Predicate<A> arg2)
public static <A> Predicate<A> or(Predicate<A> arg1,
Predicate<A> arg2)
public static <T> Predicate<T> FALSE(Class<T> cls)
public static <T> Predicate<T> TRUE(Class<T> cls)
public static <A> Predicate<A> not(Predicate<A> arg1)
public static <A> void filter(List<A> arg,
List<A> result,
Predicate<A> predicate)
public static <A> List<A> filter(List<A> arg,
Predicate<A> predicate)
public static <A> A find(List<A> arg,
Predicate<A> predicate)
public static <A,R> R fold(List<A> list,
R initial,
BinaryFunction<R,A,R> func)
public static <S,T> List<T> flatten(List<S> list,
UnaryFunction<S,List<T>> map)
S - Type of elements of list.T - Type of elements of result.list - List of elements of type S.map - function mapping S to List
public static <T> T getFirst(Collection<T> list,
Runnable handleEmptyList)
T - The type of the list element.list - The listhandleEmptyList - A runnable to call when the list is empty. Typically
throws an exception.
public static List convertToList(Object arg)
public static String convertToString(Object arg)
arg - Object to convert.
public static Map<String,Object> getAnnotationValues(Annotation ann,
boolean convertArraysToLists)
ann - The annotation to examine.convertArraysToLists - true if annotation values of array type
should be converted to an appropriate list. This is often MUCH more
useful, but some contexts require arrays.
public static <T> T doPrivileged(Algorithms.Action<T> func)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||