public final class Functions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Functions.BoundedConsumer |
Modifier and Type | Field and Description |
---|---|
static Action |
EMPTY_ACTION |
static LongConsumer |
EMPTY_LONG_CONSUMER |
static Runnable |
EMPTY_RUNNABLE |
static Consumer<Throwable> |
ERROR_CONSUMER |
static Consumer<Throwable> |
ON_ERROR_MISSING
Wraps the consumed Throwable into an OnErrorNotImplementedException and
signals it to the plugin error handler.
|
static Consumer<org.reactivestreams.Subscription> |
REQUEST_MAX |
Modifier and Type | Method and Description |
---|---|
static <T> Consumer<T> |
actionConsumer(Action action) |
static <T> Predicate<T> |
alwaysFalse() |
static <T> Predicate<T> |
alwaysTrue() |
static <T> Consumer<T> |
boundedConsumer(int bufferSize) |
static <T,U> Function<T,U> |
castFunction(Class<U> target)
Returns a function that cast the incoming values via a Class object.
|
static <T> Callable<List<T>> |
createArrayList(int capacity) |
static <T> Callable<Set<T>> |
createHashSet() |
static <T> Consumer<T> |
emptyConsumer()
Returns an empty consumer that does nothing.
|
static <T> Predicate<T> |
equalsWith(T value) |
static Action |
futureAction(Future<?> future)
Wraps the blocking get call of the Future into an Action.
|
static <T> Function<T,T> |
identity()
Returns an identity function that simply returns its argument.
|
static <T,U> Predicate<T> |
isInstanceOf(Class<U> clazz) |
static <T> Callable<T> |
justCallable(T value)
Returns a Callable that returns the given value.
|
static <T,U> Function<T,U> |
justFunction(U value)
Returns a Function that ignores its parameter and returns the given value.
|
static <T> Function<List<T>,List<T>> |
listSorter(Comparator<? super T> comparator) |
static <T> Comparator<T> |
naturalComparator() |
static <T> Comparator<T> |
naturalOrder()
Returns a natural order comparator which casts the parameters to Comparable.
|
static <T> Action |
notificationOnComplete(Consumer<? super Notification<T>> onNotification) |
static <T> Consumer<Throwable> |
notificationOnError(Consumer<? super Notification<T>> onNotification) |
static <T> Consumer<T> |
notificationOnNext(Consumer<? super Notification<T>> onNotification) |
static <T> Callable<T> |
nullSupplier() |
static <T> Predicate<T> |
predicateReverseFor(BooleanSupplier supplier) |
static <T> Function<T,Timed<T>> |
timestampWith(TimeUnit unit,
Scheduler scheduler) |
static <T1,T2,R> Function<Object[],R> |
toFunction(BiFunction<? super T1,? super T2,? extends R> f) |
static <T1,T2,T3,R> |
toFunction(Function3<T1,T2,T3,R> f) |
static <T1,T2,T3,T4,R> |
toFunction(Function4<T1,T2,T3,T4,R> f) |
static <T1,T2,T3,T4,T5,R> |
toFunction(Function5<T1,T2,T3,T4,T5,R> f) |
static <T1,T2,T3,T4,T5,T6,R> |
toFunction(Function6<T1,T2,T3,T4,T5,T6,R> f) |
static <T1,T2,T3,T4,T5,T6,T7,R> |
toFunction(Function7<T1,T2,T3,T4,T5,T6,T7,R> f) |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
toFunction(Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> f) |
static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> |
toFunction(Function9<T1,T2,T3,T4,T5,T6,T7,T8,T9,R> f) |
static <T,K> BiConsumer<Map<K,T>,T> |
toMapKeySelector(Function<? super T,? extends K> keySelector) |
static <T,K,V> BiConsumer<Map<K,V>,T> |
toMapKeyValueSelector(Function<? super T,? extends K> keySelector,
Function<? super T,? extends V> valueSelector) |
static <T,K,V> BiConsumer<Map<K,Collection<V>>,T> |
toMultimapKeyValueSelector(Function<? super T,? extends K> keySelector,
Function<? super T,? extends V> valueSelector,
Function<? super K,? extends Collection<? super V>> collectionFactory) |
public static final Runnable EMPTY_RUNNABLE
public static final Action EMPTY_ACTION
public static final Consumer<Throwable> ON_ERROR_MISSING
public static final LongConsumer EMPTY_LONG_CONSUMER
public static final Consumer<org.reactivestreams.Subscription> REQUEST_MAX
public static <T1,T2,R> Function<Object[],R> toFunction(BiFunction<? super T1,? super T2,? extends R> f)
public static <T1,T2,T3,T4,R> Function<Object[],R> toFunction(Function4<T1,T2,T3,T4,R> f)
public static <T1,T2,T3,T4,T5,R> Function<Object[],R> toFunction(Function5<T1,T2,T3,T4,T5,R> f)
public static <T1,T2,T3,T4,T5,T6,R> Function<Object[],R> toFunction(Function6<T1,T2,T3,T4,T5,T6,R> f)
public static <T1,T2,T3,T4,T5,T6,T7,R> Function<Object[],R> toFunction(Function7<T1,T2,T3,T4,T5,T6,T7,R> f)
public static <T1,T2,T3,T4,T5,T6,T7,T8,R> Function<Object[],R> toFunction(Function8<T1,T2,T3,T4,T5,T6,T7,T8,R> f)
public static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> Function<Object[],R> toFunction(Function9<T1,T2,T3,T4,T5,T6,T7,T8,T9,R> f)
public static <T> Function<T,T> identity()
T
- the input and output value typepublic static <T> Consumer<T> emptyConsumer()
T
- the consumed value type, the value is ignoredpublic static <T> Predicate<T> alwaysTrue()
public static <T> Predicate<T> alwaysFalse()
public static <T> Callable<T> nullSupplier()
public static <T> Comparator<T> naturalOrder()
T
- the value typepublic static Action futureAction(Future<?> future)
future
- the future to call get() on, not nullpublic static <T> Callable<T> justCallable(T value)
T
- the value typevalue
- the value to returnpublic static <T,U> Function<T,U> justFunction(U value)
T
- the function's input typeU
- the value and return type of the functionvalue
- the value to returnpublic static <T,U> Function<T,U> castFunction(Class<U> target)
T
- the input value typeU
- the output and target typetarget
- the target classpublic static <T> Predicate<T> equalsWith(T value)
public static <T> Consumer<T> notificationOnNext(Consumer<? super Notification<T>> onNotification)
public static <T> Consumer<Throwable> notificationOnError(Consumer<? super Notification<T>> onNotification)
public static <T> Action notificationOnComplete(Consumer<? super Notification<T>> onNotification)
public static <T> Predicate<T> predicateReverseFor(BooleanSupplier supplier)
public static <T> Function<T,Timed<T>> timestampWith(TimeUnit unit, Scheduler scheduler)
public static <T,K> BiConsumer<Map<K,T>,T> toMapKeySelector(Function<? super T,? extends K> keySelector)
public static <T,K,V> BiConsumer<Map<K,V>,T> toMapKeyValueSelector(Function<? super T,? extends K> keySelector, Function<? super T,? extends V> valueSelector)
public static <T,K,V> BiConsumer<Map<K,Collection<V>>,T> toMultimapKeyValueSelector(Function<? super T,? extends K> keySelector, Function<? super T,? extends V> valueSelector, Function<? super K,? extends Collection<? super V>> collectionFactory)
public static <T> Comparator<T> naturalComparator()
public static <T> Function<List<T>,List<T>> listSorter(Comparator<? super T> comparator)
public static <T> Consumer<T> boundedConsumer(int bufferSize)
Copyright © 2018 JBoss by Red Hat. All rights reserved.