Interface Supplier<T extends @Nullable Object>

All Superinterfaces:
Supplier<T>
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 Supplier<T extends @Nullable Object> extends Supplier<T>
Legacy version of java.util.function.Supplier. Semantically, this could be a factory, generator, builder, closure, or something else entirely. No guarantees are implied by this interface.

The Suppliers class provides common suppliers and related utilities.

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

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

Since:
2.0
Author:
Harry Heymann
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    May return true if object is a Supplier that behaves identically to this supplier.
    get()
    Retrieves an instance of the appropriate type.
  • Method Details

    • get

      T get()
      Retrieves an instance of the appropriate type. The returned object may or may not be a new instance, depending on the implementation.
      Specified by:
      get in interface Supplier<T extends @Nullable Object>
      Returns:
      an instance of the appropriate type
    • equals

      boolean equals(@Nullable Object object)
      May return true if object is a Supplier that behaves identically to this supplier.

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

      Historically, Supplier instances in this library have implemented this method to recognize certain cases where distinct Supplier 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 Object