uk.co.jezuk.mango
Class Bind

java.lang.Object
  extended by uk.co.jezuk.mango.Bind

public class Bind
extends java.lang.Object

The Mango Library Function Binders

Function and Predicate binding adaptors.

Author:
Jez Higgins, jez@jezuk.co.uk

Method Summary
static
<T1,T2,R> Function<T2,R>
First(BinaryFunction<T1,T2,R> f, T1 c)
          Adapts a BinaryFunction into a Function.
static
<T1,T2> Predicate<T2>
First(BinaryPredicate<T1,T2> p, T1 c)
          Special case which adapts a BinaryPredicate to a Predicate.
static
<T1,T2,R> Function<T1,R>
Second(BinaryFunction<T1,T2,R> f, T2 c)
          Adapts a BinaryFunction into a Function.
static
<T1,T2> Predicate<T1>
Second(BinaryPredicate<T1,T2> p, T2 c)
          Special case which adapts a BinaryPredicate to a Predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

First

public static <T1,T2,R> Function<T2,R> First(BinaryFunction<T1,T2,R> f,
                                             T1 c)
Adapts a BinaryFunction into a Function. If f is an object implementing BinaryFunction, then Bind.First(f, C).fn(arg) returns f(C, arg).

Intuitively, you can think of this as "binding" the first argument of a BinaryFunction to a constant, thus giving a Function.


First

public static <T1,T2> Predicate<T2> First(BinaryPredicate<T1,T2> p,
                                          T1 c)
Special case which adapts a BinaryPredicate to a Predicate. If p is a BinaryPredicate, then Bind.First(p, C).test(arg) returns p.test(C, arg).


Second

public static <T1,T2,R> Function<T1,R> Second(BinaryFunction<T1,T2,R> f,
                                              T2 c)
Adapts a BinaryFunction into a Function. If f is an object implementing BinaryFunction, then Bind.Second(f, C).fn(arg) returns f(arg, C).

Intuitively, you can think of this as "binding" the second argument of a BinaryFunction to a constant, thus giving a Function.


Second

public static <T1,T2> Predicate<T1> Second(BinaryPredicate<T1,T2> p,
                                           T2 c)
Special case which adapts a BinaryPredicate to a Predicate. If p is a BinaryPredicate, then Bind.Second(p, C).test(arg) returns p.test(arg, C).



Copyright © 2002-2010 JezUK Ltd.