Interface Function<F,T>
-
- All Superinterfaces:
Function<F,T>
- All Known Subinterfaces:
LoadingCache<K,V>
- All Known Implementing Classes:
AbstractLoadingCache,Converter,ForwardingLoadingCache,ForwardingLoadingCache.SimpleForwardingLoadingCache
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@GwtCompatible @FunctionalInterface public interface Function<F,T> extends Function<F,T>
Legacy version ofjava.util.function.Function.The
Functionsclass provides common functions and related utilities.As this interface extends
java.util.function.Function, an instance of this type can be used as ajava.util.function.Functiondirectly. To use ajava.util.function.Functionin a context where acom.google.common.base.Functionis needed, usefunction::apply.This interface is now a legacy type. Use
java.util.function.Function(or the appropriate primitive specialization such asToIntFunction) 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.- Since:
- 2.0
- Author:
- Kevin Bourrillion
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable Tapply(@Nullable F input)Applies this function to the given argument.booleanequals(@Nullable Object object)May returntrueifobjectis aFunctionthat behaves identically to this function.
-
-
-
Method Detail
-
apply
@CanIgnoreReturnValue @Nullable T apply(@Nullable F input)
Description copied from interface:java.util.function.FunctionApplies this function to the given argument.
-
equals
boolean equals(@Nullable Object object)
May returntrueifobjectis aFunctionthat behaves identically to this function.Warning: do not depend on the behavior of this method.
Historically,
Functioninstances in this library have implemented this method to recognize certain cases where distinctFunctioninstances would in fact behave identically. However, as code migrates tojava.util.function, that behavior will disappear. It is best not to depend on it.- Overrides:
equalsin classObject- Parameters:
object- the reference object with which to compare.- Returns:
trueif this object is the same as the obj argument;falseotherwise.- See Also:
Object.hashCode(),HashMap
-
-