Interface Function<F extends @Nullable java.lang.Object,​T extends @Nullable java.lang.Object>

  • All Superinterfaces:
    java.util.function.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 extends @Nullable java.lang.Object,​T extends @Nullable java.lang.Object>
    extends java.util.function.Function<F,​T>
    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.

    Since:
    2.0
    Author:
    Kevin Bourrillion
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T apply​(F input)  
      boolean equals​(java.lang.Object object)
      May return true if object is a Function that behaves identically to this function.
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Method Detail

      • apply

        T apply​(F input)
        Specified by:
        apply in interface java.util.function.Function<F extends @Nullable java.lang.Object,​T extends @Nullable java.lang.Object>
      • equals

        boolean equals​(@CheckForNull
                       java.lang.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.

        Overrides:
        equals in class java.lang.Object