RxCurryingFunc { public static <A, B, R> Func1<A, Func1<B, R>> curry(final Func2<A, B, R> func) { return new Func1<A, Func1<B, R>>() { @Override public Func1<B, R> call(final A a) { return new Func1<B, R>() { @Override public R call(final B b) { return func.call(a, b); } }; } }; } private  RxCurryingFunc(); static Func1<A, Func1<B, R>> curry(final Func2<A, B, R> func); static Func1<A, Func1<B, Func1<C, R>>> curry(final Func3<A, B, C, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, R>>>> curry(
            final Func4<A, B, C, D, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, Func1<E, R>>>>> curry(
            final Func5<A, B, C, D, E, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, Func1<E, Func1<F, R>>>>>> curry(
            final Func6<A, B, C, D, E, F, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, Func1<E, Func1<F, Func1<G, R>>>>>>> curry(
            final Func7<A, B, C, D, E, F, G, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, Func1<E, Func1<F, Func1<G, Func1<H, R>>>>>>>> curry(
            final Func8<A, B, C, D, E, F, G, H, R> func); static Func1<A, Func1<B, Func1<C, Func1<D, Func1<E, Func1<F, Func1<G, Func1<H, Func1<I, R>>>>>>>>> curry(
            final Func9<A, B, C, D, E, F, G, H, I, R> func);  }
@Test public void curry() throws Exception { Func1<String, Func1<String, Func1<String, Func1<String, Func1<String, String>>>>> secondVariable = RxCurryingFunc .curry(new Func5<String, String, String, String, String, String>() { @Override public String call(String first, String second, String third, String fourth, String fifth) { return first + second + third + fourth + fifth; } }); String result = secondVariable.call("Hello ").call("This ").call("Is ").call("Curried ") .call("Func"); Assert.assertEquals("Hello This Is Curried Func", result); }