Class Opt.Single<T>

  • Type Parameters:
    T - Type of item
    All Implemented Interfaces:
    Opt<T>
    Enclosing interface:
    Opt<T>

    public static final class Opt.Single<T>
    extends Object
    implements Opt<T>
    Holder for a single element only.

    The class is immutable and thread-safe.

    Since:
    0.14
    • Constructor Detail

      • Single

        public Single​(T orgn)
        Ctor.
        Parameters:
        orgn - Origin
    • Method Detail

      • get

        public T get()
        Description copied from interface: Opt
        Returns the contained instance.
        Specified by:
        get in interface Opt<T>
        Returns:
        Instance
      • has

        public boolean has()
        Description copied from interface: Opt
        Returns true if contains instance.
        Specified by:
        has in interface Opt<T>
        Returns:
        True if present