Class Holder<T>

java.lang.Object
org.tentackle.misc.Holder<T>
Type Parameters:
T - the object type
All Implemented Interfaces:
Consumer<T>, Supplier<T>
Direct Known Subclasses:
BlockingHolder

public class Holder<T> extends Object implements Consumer<T>, Supplier<T>
A generic consumer and supplier to hold some object.
Useful in lambdas if some data has to be set within the enclosing method.
Author:
harald
See Also:
  • Constructor Details

    • Holder

      public Holder()
      Creates a holder without an initial value.
    • Holder

      public Holder(T t)
      Creates a holder with an initial value.
      Parameters:
      t - the initial value
  • Method Details