Package com.linecorp.armeria.common.util
Class Functions
java.lang.Object
com.linecorp.armeria.common.util.Functions
public final class Functions extends Object
Utility methods related with function composition.
-
Method Summary
Modifier and Type Method Description static <A, B, C> Function<A,C>
compose(Function<A,B> f1, Function<B,C> f2)
static <A, B, C, D> Function<A,D>
compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3)
static <A, B, C, D, E>
Function<A,E>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4)
static <A, B, C, D, E, F>
Function<A,F>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5)
static <A, B, C, D, E, F, G>
Function<A,G>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6)
static <A, B, C, D, E, F, G, H>
Function<A,H>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7)
static <A, B, C, D, E, F, G, H, I>
Function<A,I>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7, Function<H,I> f8)
static <A, B, C, D, E, F, G, H, I, J>
Function<A,J>compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7, Function<H,I> f8, Function<I,J> f9)
static <T, U> BiFunction<T,U,T>
first()
Returns aBiFunction
that returns the first argument.static <T, U> BiFunction<T,U,U>
second()
Returns aBiFunction
that returns the second argument.static <T, U> BiFunction<T,U,Void>
voidFunction(BiConsumer<T,U> consumer)
static <T> Function<T,Void>
voidFunction(Consumer<T> consumer)
-
Method Details
-
compose
Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D> Function<A,D> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E> Function<A,E> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E, F> Function<A,F> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E, F, G> Function<A,G> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E, F, G, H> Function<A,H> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E, F, G, H, I> Function<A,I> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7, Function<H,I> f8)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
compose
public static <A, B, C, D, E, F, G, H, I, J> Function<A,J> compose(Function<A,B> f1, Function<B,C> f2, Function<C,D> f3, Function<D,E> f4, Function<E,F> f5, Function<F,G> f6, Function<G,H> f7, Function<H,I> f8, Function<I,J> f9)Returns aFunction
that composes the specifiedFunction
s with chainedFunction.andThen(Function)
. It is useful when you need to compose method handles, which is impossible withFunction.andThen(Function)
:Function<A, B> f = Functions.compose(TypeA::new, TypeB::new);
-
voidFunction
-
voidFunction
-
first
Returns aBiFunction
that returns the first argument. -
second
Returns aBiFunction
that returns the second argument.
-