com.atlassian.util.concurrent
Class Functions

java.lang.Object
  extended by com.atlassian.util.concurrent.Functions

public final class Functions
extends java.lang.Object


Method Summary
static
<D,R> Function<D,R>
fromSupplier(Supplier<R> supplier)
          Get a function that uses the Supplier as a factory for all inputs.
static
<T> Function<T,T>
identity()
          Get a function that always returns the input.
static
<T,R> com.google.common.base.Function<T,R>
toGoogleFunction(Function<T,R> function)
          Map to a google-collections Function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromSupplier

public static <D,R> Function<D,R> fromSupplier(@NotNull
                                               Supplier<R> supplier)
Get a function that uses the Supplier as a factory for all inputs.

Type Parameters:
D - the key type, ignored
R - the result type
Parameters:
supplier - called for all inputs
Returns:
the function

identity

public static <T> Function<T,T> identity()
Get a function that always returns the input.

Type Parameters:
T - the type of the input and the output for the function.
Returns:
the identity function.

toGoogleFunction

public static <T,R> com.google.common.base.Function<T,R> toGoogleFunction(Function<T,R> function)
Map to a google-collections Function.

Type Parameters:
T - input type
R - output type
Parameters:
function - the function to map
Returns:
the mapped function.


Copyright © 2011 Atlassian. All Rights Reserved.