Class Suppliers

java.lang.Object
org.apache.commons.lang3.function.Suppliers

public class Suppliers extends Object
Helps use Supplier.
Since:
3.13.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static Supplier
    Returns the singleton supplier that always returns null.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    TODO Make private in 4.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    get(Supplier<T> supplier)
    Gets the result of Supplier.get(), or null if the supplier is null.
    static <T> Supplier<T>
    nul()
    Gets the singleton supplier that always returns null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NUL

      private static Supplier NUL
      Returns the singleton supplier that always returns null.

      This supplier never throws an exception.

  • Constructor Details

    • Suppliers

      @Deprecated public Suppliers()
      Deprecated.
      TODO Make private in 4.0.
      Make private in 4.0.
  • Method Details

    • get

      public static <T> T get(Supplier<T> supplier)
      Gets the result of Supplier.get(), or null if the supplier is null.
      Type Parameters:
      T - The type of results supplied by this supplier.
      Parameters:
      supplier - The supplier or null.
      Returns:
      Result of Supplier.get() or null.
    • nul

      public static <T> Supplier<T> nul()
      Gets the singleton supplier that always returns null.

      This supplier never throws an exception.

      Type Parameters:
      T - Supplied type.
      Returns:
      The NUL singleton.
      Since:
      3.14.0