Package: org.apache.groovy.util

## [Java] Class Lambdas

- org.apache.groovy.util.Lambdas

-     public class Lambdas
      extends Object

  Helpers that return function types.

  For variants whose results are also Closure instances, see Closures.

  Since:
    6.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<T, P>` | `public static Predicate<T>` | `curryWith(BiPredicate<? super T, ? super P> bp, P p)` Right-partials a BiPredicate with the supplied parameter, returning a Predicate that fixes the second argument.
    `<T, P, R>` | `public static Function<T, R>` | `curryWith(BiFunction<? super T, ? super P, ? extends R> bf, P p)` Right-partials a BiFunction with the supplied parameter, returning a Function that fixes the second argument.
    `<T, P>` | `public static Consumer<T>` | `curryWith(BiConsumer<? super T, ? super P> bc, P p)` Right-partials a BiConsumer with the supplied parameter, returning a Consumer that fixes the second argument.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### <T, P> public static Predicate<T> curryWith(BiPredicate<? super T, ? super P> bp, P p)

      Right-partials a BiPredicate with the supplied parameter, returning a Predicate that fixes the second argument.

           BiPredicate<Integer,Integer> divisibleBy = (n, d) -> n % d == 0
           assert [1, 2, 3, 4, 5].stream().filter(curryWith(divisibleBy, 2)).toList() == [2, 4]

      Since:
        6.0.0

    - #### <T, P, R> public static Function<T, R> curryWith(BiFunction<? super T, ? super P, ? extends R> bf, P p)

      Right-partials a BiFunction with the supplied parameter, returning a Function that fixes the second argument.

           BiFunction<String,Integer,String> repeat = (s, n) -> s * n
           assert ['a', 'b', 'c'].stream().map(curryWith(repeat, 3)).toList() == ['aaa', 'bbb', 'ccc']

      Since:
        6.0.0

    - #### <T, P> public static Consumer<T> curryWith(BiConsumer<? super T, ? super P> bc, P p)

      Right-partials a BiConsumer with the supplied parameter, returning a Consumer that fixes the second argument.

           def sink = []
           BiConsumer<String,List> addTo = (s, list) -> list << s
           ['a', 'b', 'c'].stream().forEach(curryWith(addTo, sink))
           assert sink == ['a', 'b', 'c']

      Since:
        6.0.0