|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qi4j.functional.Functions
public final class Functions
Utility functions. Combine these with methods in Iterables, for example. See FunctionsTest for usages.
Constructor Summary | |
---|---|
Functions()
|
Method Summary | ||
---|---|---|
static
|
comparator(Function<T,java.lang.Comparable> comparableFunction)
Creates a comparator that takes a function as input. |
|
static
|
compose()
|
|
static
|
compose(Function<? super MIDDLE,TO> outer,
Function<FROM,MIDDLE> inner)
compose(F1(M,T),F2(F,M)) = F1(F2(F)) -> T |
|
static
|
count(Specification<T> specification)
Count the number of items in an iterable that matches a given specification. |
|
static
|
filteredMap(Specification<T> specification,
Function<T,T> function)
Only apply given function on objects that satisfies the given specification. |
|
static
|
fromMap(java.util.Map<FROM,TO> map)
|
|
static
|
identity()
|
|
static
|
indexOf(Specification<T> specification)
Find out the index of an item matching a given specification in an iterable. |
|
static
|
indexOf(T item,
java.lang.Iterable<T> iterable)
Find out the index of an item in an iterable. |
|
static Function<java.lang.Number,java.lang.Integer> |
intSum()
|
|
static Function<java.lang.Number,java.lang.Long> |
longSum()
|
|
static
|
withDefault(T defaultValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Functions()
Method Detail |
---|
public static <A,B,C> Function2<Function<? super B,C>,Function<A,B>,Function<A,C>> compose()
public static <FROM,MIDDLE,TO> Function<FROM,TO> compose(Function<? super MIDDLE,TO> outer, Function<FROM,MIDDLE> inner)
FROM
- MIDDLE
- TO
- outer
- inner
-
public static <TO,FROM extends TO> Function<FROM,TO> identity()
public static <FROM,TO> Function<FROM,TO> fromMap(java.util.Map<FROM,TO> map)
public static <T> Function<T,T> withDefault(T defaultValue)
public static Function<java.lang.Number,java.lang.Long> longSum()
public static Function<java.lang.Number,java.lang.Integer> intSum()
public static <T> Function<T,java.lang.Integer> count(Specification<T> specification)
T
- specification
-
public static <T> Function<T,java.lang.Integer> indexOf(Specification<T> specification)
T
- specification
-
public static <T> int indexOf(T item, java.lang.Iterable<T> iterable)
T
- item
- iterable
-
public static <T> Function<T,T> filteredMap(Specification<T> specification, Function<T,T> function)
T
- specification
- function
-
public static <T> java.util.Comparator<T> comparator(Function<T,java.lang.Comparable> comparableFunction)
T
- comparableFunction
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |