Class Holder<T>

  • All Implemented Interfaces:
    Consumer<T>
    Direct Known Subclasses:
    PassingHolder

    public class Holder<T>
    extends Object
    implements Consumer<T>
    Very simple object to hold a single value. This comes handy when a final value is required but there is a need to use immutable value (e.g. int, String). This comes very handy in Java anonymous instances (almost-closures).
    Author:
    Radovan Semancik
    • Constructor Detail

      • Holder

        public Holder()
      • Holder

        public Holder​(T value)
    • Method Detail

      • getValue

        public T getValue()
      • setValue

        public void setValue​(T value)
      • isEmpty

        public boolean isEmpty()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • accept

        public void accept​(T t)
        Specified by:
        accept in interface Consumer<T>