Top Description Methods
com.google.common.base

public Interface Function<F extends @Nullable Object, T extends @Nullable Object>

extends Function<F extends @Nullable Object, T extends @Nullable Object>
Known Direct Subinterfaces
com.google.common.base.Suppliers.SupplierFunction, com.google.common.cache.LoadingCache
Known Direct Implementers
com.google.common.base.Functions.ToStringFunction, com.google.common.base.Functions.IdentityFunction, com.google.common.base.Functions.FunctionForMapNoDefault, com.google.common.base.Functions.ForMapWithDefault, com.google.common.base.Functions.FunctionComposition, com.google.common.base.Functions.PredicateFunction, com.google.common.base.Functions.ConstantFunction, com.google.common.base.Functions.SupplierFunction, com.google.common.collect.FluentIterable.FromIterableFunction, com.google.common.collect.Interners.InternerFunction, com.google.common.collect.Maps.EntryFunction, com.google.common.base.Converter
Annotations
@GwtCompatible
@FunctionalInterface
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

Legacy version of java.util.function.Function.

The Functions class provides common functions and related utilities.

As this interface extends java.util.function.Function, an instance of this type can be used as a java.util.function.Function directly. To use a java.util.function.Function in a context where a com.google.common.base.Function is needed, use function::apply.

This interface is now a legacy type. Use java.util.function.Function (or the appropriate primitive specialization such as ToIntFunction) instead whenever possible. Otherwise, at least reduce explicit dependencies on this type by using lambda expressions or method references instead of classes, leaving your code easier to migrate in the future.

See the Guava User Guide article on the use of Function.

Author
Kevin Bourrillion
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public T
apply(F
the function argument
input
)

Redeclares java.util.function.Function.apply.

Applies this function to the given argument.
public boolean
equals(Object object)

May return true if object is a Function that behaves identically to this function.

Inherited from java.util.function.Function:
andThencomposeidentity

Method Detail

applyback to summary
public T apply(F input)

Redeclares java.util.function.Function.apply.

Doc from java.util.function.Function.apply.

Applies this function to the given argument.

Parameters
input:F

the function argument

Returns:T

the function result

Annotations
@Override
@ParametricNullness
equalsback to summary
public boolean equals(Object object)

May return true if object is a Function that behaves identically to this function.

Warning: do not depend on the behavior of this method.

Historically, Function instances in this library have implemented this method to recognize certain cases where distinct Function instances would in fact behave identically. However, as code migrates to java.util.function, that behavior will disappear. It is best not to depend on it.

Annotations
@Override