uk.co.jezuk.mango
Class Functions

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

public class Functions
extends java.lang.Object

The Mango Library Unary Functions

A Function describes a function which takes one argument - fn(x). It returns some T and returns and object of type R. T and R may be the same time). A Function may return the same object or different objects for each invocation, even given the same argument. It can refer to local state, perform disk reads or writes, or whatever.

Author:
Jez Higgins, jez@jezuk.co.uk
See Also:
Function, Predicates

Constructor Summary
Functions()
           
 
Method Summary
static
<T,T2,R> Function<T,R>
Compose(Function<T2,R> f, Function<T,T2> g)
          Compose is a unary function adaptor.
static
<T,R> Function<T,R>
Constant(R value)
          Returns the initial value, regardless of the argument passed to the function
static
<T> Function<T,T>
Identity()
          The identity function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

Compose

public static <T,T2,R> Function<T,R> Compose(Function<T2,R> f,
                                             Function<T,T2> g)
Compose is a unary function adaptor. If f and g are Functions, then Compose creates a new function h, where h(x) is equal to f(g(x)).


Identity

public static <T> Function<T,T> Identity()
The identity function. Takes a single argument, and returns it unchanged.


Constant

public static <T,R> Function<T,R> Constant(R value)
Returns the initial value, regardless of the argument passed to the function



Copyright © 2002-2010 JezUK Ltd.