Package com.gengoai.function
Class Funcs
- java.lang.Object
-
- com.gengoai.function.Funcs
-
public final class Funcs extends Object
The type Funcs.- Author:
- David B. Bracewell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Funcs.When<I,O>
The type When.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Consumer<T>
asConsumer(Function<? super T,?> function)
As consumer consumer.static <T,R>
Function<T,R>asFunction(Consumer<? super T> consumer)
As function function.static <T,R>
Function<T,R>asFunction(Consumer<? super T> consumer, R returnValue)
As function function.static <T> Predicate<T>
instanceOf(Class<?> clazz)
static <T,R>
Function<T,R>literal(R returnValue)
static <I,O>
Funcs.When<I,O>when(SerializablePredicate<? super I> predicate, SerializableFunction<? super I,? extends O> trueAction)
When when.static <I,O>
Funcs.When<I,O>when(SerializablePredicate<? super I> predicate, O trueValue)
When when.
-
-
-
Method Detail
-
literal
public static <T,R> Function<T,R> literal(R returnValue)
-
asConsumer
public static <T> Consumer<T> asConsumer(Function<? super T,?> function)
As consumer consumer.- Type Parameters:
T
- the type parameter- Parameters:
function
- the function- Returns:
- the consumer
-
asFunction
public static <T,R> Function<T,R> asFunction(Consumer<? super T> consumer, R returnValue)
As function function.- Type Parameters:
T
- the type parameterR
- the type parameter- Parameters:
consumer
- the consumerreturnValue
- the return value- Returns:
- the function
-
asFunction
public static <T,R> Function<T,R> asFunction(Consumer<? super T> consumer)
As function function.- Type Parameters:
T
- the type parameterR
- the type parameter- Parameters:
consumer
- the consumer- Returns:
- the function
-
when
public static <I,O> Funcs.When<I,O> when(SerializablePredicate<? super I> predicate, SerializableFunction<? super I,? extends O> trueAction)
When when.- Type Parameters:
I
- the type parameterO
- the type parameter- Parameters:
predicate
- the predicatetrueAction
- the true action- Returns:
- the when
-
when
public static <I,O> Funcs.When<I,O> when(SerializablePredicate<? super I> predicate, O trueValue)
When when.- Type Parameters:
I
- the type parameterO
- the type parameter- Parameters:
predicate
- the predicatetrueValue
- the true value- Returns:
- the when
-
-