Class OptBool


  • public final class OptBool
    extends Object
    Utility for working with Optional<Boolean>s.

    This also saves memory by holding three static instances of Optional<Boolean>, which represents the possible states it can have.

    • Field Detail

      • EMPTY

        public static final Optional<Boolean> EMPTY
        The absent value.

        Also a shorthand for constructing instances with Optional.<Boolean>empty().

    • Method Detail

      • of

        public static Optional<Boolean> of​(boolean bool)
        Constructs a new Optional<Boolean> from the given boolean.
        Parameters:
        bool - The boolean
        Returns:
        The constructed Optional