Interface Supplier<T>

Type Parameters:
T - the supplied type
All Superinterfaces:
Supplier<T>
All Known Subinterfaces:
BlockingReference.Writer<T>, ContextualBatch, IdentifierFactoryService<I>
All Known Implementing Classes:
AbstractContextualBatch, AffinityIdentifierFactoryService, BlockingReference.ConditionalReferenceWriter, BlockingReference.ReferenceWriter, DefaultTransactionalBatch, SimpleContextualBatch, SimpleContextualBatchFactory, SimpleIdentifierFactoryService, ThreadContextBatchFactory, TransactionalBatchFactory

public interface Supplier<T> extends Supplier<T>
An enhanced supplier.
Author:
Paul Ferraro
  • Field Details

    • NULL

      static final Supplier<?> NULL
      A supplier that always returns null
  • Method Details

    • thenAccept

      default Runner thenAccept(Consumer<T> consumer)
      Returns a Runnable that consumes the supplied value.
      Parameters:
      consumer - a consumer of the supplied value
      Returns:
      a Runnable that consumes the supplied value.
    • thenApply

      default <R> Supplier<R> thenApply(Function<T,R> function)
      Returns a supplier that returns the value this supplier mapped via the specified function.
      Type Parameters:
      R - the mapped value type
      Parameters:
      function - a mapping function
      Returns:
      a supplier that returns the value this supplier mapped via the specified function.
    • thenApplyAsDouble

      default DoubleSupplier thenApplyAsDouble(ToDoubleFunction<T> mapper)
      Returns a supplier that returns the value this supplier mapped via the specified function.
      Parameters:
      mapper - a mapping function
      Returns:
      a supplier that returns the value this supplier mapped via the specified function.
    • thenApplyAsInt

      default IntSupplier thenApplyAsInt(ToIntFunction<T> mapper)
      Returns a supplier that returns the value this supplier mapped via the specified function.
      Parameters:
      mapper - a mapping function
      Returns:
      a supplier that returns the value this supplier mapped via the specified function.
    • thenApplyAsLong

      default LongSupplier thenApplyAsLong(ToLongFunction<T> mapper)
      Returns a supplier that returns the value this supplier mapped via the specified function.
      Parameters:
      mapper - a mapping function
      Returns:
      a supplier that returns the value this supplier mapped via the specified function.
    • thenTest

      default BooleanSupplier thenTest(Predicate<T> predicate)
      Returns a supplier that returns the value this supplier mapped via the specified predicate.
      Parameters:
      predicate - a mapping predicate
      Returns:
      a supplier that returns the value this supplier mapped via the specified predicate.
    • handle

      default Supplier<T> handle(Function<RuntimeException, T> handler)
      Returns a new supplier that delegates to this supplier using the specified exception handler.
      Parameters:
      handler - an exception handler
      Returns:
      a new supplier that delegates to this supplier using the specified exception handler.
    • empty

      static <T> Supplier<T> empty()
      Returns a supplier that always returns the specified value.
      Type Parameters:
      T - the supplied type
      Returns:
      a supplier that always returns the specified value.
    • of

      static <T> Supplier<T> of(T value)
      Returns a supplier that always returns the specified value.
      Type Parameters:
      T - the supplied type
      Parameters:
      value - the supplied value
      Returns:
      a supplier that always returns the specified value.
    • run

      static <T> Supplier<T> run(Runnable task)
      Returns a supplier that returns null after invoking the specified task.
      Type Parameters:
      T - the supplied type
      Parameters:
      task - the task to run
      Returns:
      a supplier that returns null after invoking the specified task.
    • call

      static <T> Supplier<T> call(Callable<T> caller, Function<Exception, T> handler)
      Returns a supplier that delegates to the specified caller using the specified exception handler.
      Type Parameters:
      T - the supplied type
      Parameters:
      caller - the caller to call
      handler - an exception handler
      Returns:
      a supplier that delegates to the specified caller using the specified exception handler.
    • entry

      static <K,V> Supplier<Map.Entry<K,V>> entry(Supplier<K> key, Supplier<V> value)
      Returns a supplier of a Map.Entry from the specified key and value suppliers.
      Type Parameters:
      K - the entry key type
      V - the entry value type
      Parameters:
      key - an entry key supplier
      value - an entry value supplier
      Returns:
      a supplier of a Map.Entry from the specified key and value suppliers.