Class Option<A>

java.lang.Object
com.atlassian.upm.api.util.Option<A>
Type Parameters:
A - the type of element the option wraps
All Implemented Interfaces:
Iterable<A>

public abstract class Option<A> extends Object implements Iterable<A>
Deprecated.
It's 2021. Just use Optional. Plus there's the same class in com.atlassian.fugue
An Option<T> is a wrapper for a value of type T. It can be either a none() or a some(Object)}
  • Method Details

    • fold

      public abstract <B> B fold(Supplier<B> none, Function<A,B> some)
      Deprecated.
      If this is a some value apply the some function, otherwise get the none value.
      Type Parameters:
      B - the result type
      Parameters:
      none - the supplier of the None type
      some - the function to apply if we are a some
      Returns:
      the appropriate value
    • get

      public final A get()
      Deprecated.
      Returns:
      the wrapped value
      Throws:
      NoSuchElementException - if this is a none
    • getOrElse

      public final <B extends A> A getOrElse(B other)
      Deprecated.
      Returns wrapped value if this is a some, otherwise returns other.
      Parameters:
      other - value to return if this is a none
      Returns:
      wrapped value if this is a some, otherwise returns other
    • getOrElse

      public final A getOrElse(Supplier<A> supplier)
      Deprecated.
      Returns:
      the wrapped value if this is a some, otherwise return the value supplied from the Supplier
    • isDefined

      public final boolean isDefined()
      Deprecated.
      Returns:
      true if this is a some, false otherwise.
    • iterator

      @Nonnull public final Iterator<A> iterator()
      Deprecated.
      Specified by:
      iterator in interface Iterable<A>
    • orElse

      public final Option<A> orElse(Option<A> orElse)
      Deprecated.
      Returns this if this is a some, otherwise returns orElse.
    • orElse

      public final Option<A> orElse(Supplier<Option<A>> orElse)
      Deprecated.
      Returns this if this is a some, otherwise returns orElse.
    • filter

      public final Option<A> filter(Predicate<A> f)
      Deprecated.
    • exists

      public final boolean exists(Predicate<A> f)
      Deprecated.
      Parameters:
      f - the predicate to apply if we are a some
      Returns:
      true if this is a some value for which the predicate returns true, otherwise false
    • flatMap

      public final <B> Option<B> flatMap(Function<A,Option<B>> f)
      Deprecated.
      Apply f to the wrapped value.
      Type Parameters:
      B - return type of f
      Parameters:
      f - function to apply to wrapped value
      Returns:
      value returned from f
    • map

      public final <B> Option<B> map(Function<A,B> f)
      Deprecated.
      Apply f to the wrapped value.
      Type Parameters:
      B - return type of f
      Parameters:
      f - function to apply to wrapped value
      Returns:
      new wrapped value
    • hashCode

      public final int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Deprecated.
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • none

      public static <A> Option<A> none()
      Deprecated.
    • none

      public static <A> Option<A> none(Class<A> type)
      Deprecated.
    • some

      public static <A> Option<A> some(A value)
      Deprecated.
    • option

      public static <A> Option<A> option(A a)
      Deprecated.