Class MonotonicSupplier<E>

Type Parameters:
E - Element type
All Implemented Interfaces:
Consumer<E>, Supplier<E>

public class MonotonicSupplier<E> extends Object implements Consumer<E>, Supplier<E>
Supplier that awaits a value and allows the value to be set, once, to a not-null value. The value supplied by get() is never null.

Not thread-safe.

  • Constructor Details

    • MonotonicSupplier

      public MonotonicSupplier()
  • Method Details

    • accept

      public void accept(E e)

      Sets the value once and for all.

      Specified by:
      accept in interface Consumer<E>
    • get

      public E get()
      Specified by:
      get in interface Supplier<E>