Class Option.None

java.lang.Object
io.atlassian.fugue.Option<Object>
io.atlassian.fugue.Option.None
All Implemented Interfaces:
Effect.Applicant<Object>, Maybe<Object>, Serializable, Iterable<Object>
Enclosing class:
Option<A>

static final class Option.None extends Option<Object>
One of the big two actual implementation classes.
Since:
4.2.0
  • Field Details

  • Constructor Details

    • None

      None()
  • Method Details

    • fold

      public <B> B fold(Supplier<? extends B> none, Function<? super Object, ? extends B> some)
      Description copied from class: Option
      If this is a some value apply the some function, otherwise get the None value.
      Specified by:
      fold in class Option<Object>
      Type Parameters:
      B - the result type
      Parameters:
      none - the supplier of the None type
      some - the function to apply if this is a Some
      Returns:
      the appropriate value
    • get

      public Object get()
      Description copied from interface: Maybe
      Get the value if defined. Throw an exception otherwise.
      Returns:
      the wrapped value
    • isDefined

      public boolean isDefined()
      Description copied from interface: Maybe
      If the type contains a value return true.
      Returns:
      true if this holds a value, false otherwise.
    • getOrError

      public Object getOrError(Supplier<String> err)
      Description copied from interface: Maybe
      Get the value or throws an error with the supplied message if not defined.

      Used when absolutely sure this is defined.

      Parameters:
      err - the message for the error.
      Returns:
      the contained value.
    • getOrThrow

      public <X extends Throwable> Object getOrThrow(Supplier<X> ifUndefined) throws X
      Description copied from interface: Maybe
      Get the value or throws the supplied throwable if not defined.

      Used when absolutely sure this is defined.

      Type Parameters:
      X - exception type
      Parameters:
      ifUndefined - the supplier of the throwable.
      Returns:
      the contained value.
      Throws:
      X - the throwable the supplier creates if there is no value.
    • foreach

      @Deprecated public void foreach(Effect<? super Object> effect)
      Deprecated.
      Description copied from interface: Effect.Applicant
      Perform the given side-effect for each contained element.
      Parameters:
      effect - the input to use for performing the effect.
    • forEach

      public void forEach(Consumer<? super Object> effect)
    • toOptional

      public Optional<Object> toOptional()
      Description copied from class: Option
      Create an Optional from this option. Will throw a NullPointerException if this option is defined and contains a null value.
      Specified by:
      toOptional in class Option<Object>
      Returns:
      Optional.of(Object) with the value if defined and not null, Optional.empty() if not defined.
    • toStream

      public Stream<Object> toStream()
      Description copied from class: Option
      Create a Stream from this option.
      Specified by:
      toStream in class Option<Object>
      Returns:
      Stream.of(Object) with the value if defined, Stream.empty() if not defined.
    • contains

      public boolean contains(Object elem)
      Description copied from interface: Maybe
      Tests whether the option contains a given value as an element.
      Parameters:
      elem - the element to test
      Returns:
      true if the option has an element that is equal to elem, false otherwise
    • readResolve

      private Object readResolve()