public abstract class

Option

extends Object
implements Iterable<T>
java.lang.Object
   ↳ com.atlassian.upm.api.util.Option<A>

This class is deprecated.
It's 2021. Just use java.util.Optional. Plus there's the same class in com.atlassian.fugue

Class Overview

An Option<T> is a wrapper for a value of type T. It can be either a none() or a some(Object)}

Summary

Public Methods
final boolean equals(Object obj)
@Deprecated final boolean exists(Predicate<A> f)
This method is deprecated. since 5.0, it will be removed in 6.0; use exists(Predicate) instead
final boolean exists(Predicate<A> f)
final Option<A> filter(Predicate<A> f)
@Deprecated final Option<A> filter(Predicate<A> f)
This method is deprecated. since 5.0, it will be removed in 6.0; use filter(Predicate) instead
final <B> Option<B> flatMap(Function<A, Option<B>> f)
Apply f to the wrapped value.
@Deprecated final <B> Option<B> flatMap(Function<A, Option<B>> f)
This method is deprecated. since 5.0, it will be removed in 6.0; use flatMap(Function) instead
abstract <B> B fold(Supplier<B> none, Function<A, B> some)
If this is a some value apply the some function, otherwise get the none value.
@Deprecated <B> B fold(Supplier<B> none, Function<A, B> some)
This method is deprecated. since 5.0, it will be removed in 6.0; use fold(Supplier, Function) instead
final A get()
final <B extends A> A getOrElse(B other)
Returns wrapped value if this is a some, otherwise returns other.
@Deprecated final A getOrElse(Supplier<A> supplier)
This method is deprecated. since 5.0, it will be removed in 6.0; use getOrElse(Supplier) instead
final A getOrElse(Supplier<A> supplier)
final int hashCode()
final boolean isDefined()
@Nonnull final Iterator<A> iterator()
final <B> Option<B> map(Function<A, B> f)
Apply f to the wrapped value.
@Deprecated final <B> Option<B> map(Function<A, B> f)
This method is deprecated. since 5.0, it will be removed in 6.0; use map(Function) instead
static <A> Option<A> none(Class<A> type)
static <A> Option<A> none()
@Deprecated static <A> Supplier<Option<A>> noneSupplier()
This method is deprecated. since 5.0, it will be removed in 6.0; use Option::none instead
static <A> Option<A> option(A a)
@Deprecated static <A> Function<A, Option<A>> option()
This method is deprecated. since 5.0, it will be removed in 6.0; use Option::option instead
final Option<A> orElse(Supplier<Option<A>> orElse)
Returns this if this is a some, otherwise returns orElse.
final Option<A> orElse(Option<A> orElse)
Returns this if this is a some, otherwise returns orElse.
@Deprecated final Option<A> orElse(Supplier<Option<A>> orElse)
This method is deprecated. since 5.0, it will be removed in 6.0; use orElse(Supplier) instead
static <A> Option<A> some(A value)
final String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable

Public Methods

public final boolean equals (Object obj)

@Deprecated public final boolean exists (Predicate<A> f)

This method is deprecated.
since 5.0, it will be removed in 6.0; use exists(Predicate) instead

public final boolean exists (Predicate<A> f)

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

public final Option<A> filter (Predicate<A> f)

@Deprecated public final Option<A> filter (Predicate<A> f)

This method is deprecated.
since 5.0, it will be removed in 6.0; use filter(Predicate) instead

public final Option<B> flatMap (Function<A, Option<B>> f)

Apply f to the wrapped value.

Parameters
f function to apply to wrapped value
Returns
  • value returned from f

@Deprecated public final Option<B> flatMap (Function<A, Option<B>> f)

This method is deprecated.
since 5.0, it will be removed in 6.0; use flatMap(Function) instead

public abstract B fold (Supplier<B> none, Function<A, B> some)

If this is a some value apply the some function, otherwise get the none value.

Parameters
none the supplier of the None type
some the function to apply if we are a some
Returns
  • the appropriate value

@Deprecated public B fold (Supplier<B> none, Function<A, B> some)

This method is deprecated.
since 5.0, it will be removed in 6.0; use fold(Supplier, Function) instead

public final A get ()

Returns
  • the wrapped value
Throws
NoSuchElementException if this is a none

public final A getOrElse (B other)

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

@Deprecated public final A getOrElse (Supplier<A> supplier)

This method is deprecated.
since 5.0, it will be removed in 6.0; use getOrElse(Supplier) instead

public final A getOrElse (Supplier<A> supplier)

Returns
  • the wrapped value if this is a some, otherwise return the value supplied from the Supplier

public final int hashCode ()

public final boolean isDefined ()

Returns
  • true if this is a some, false otherwise.

@Nonnull public final Iterator<A> iterator ()

public final Option<B> map (Function<A, B> f)

Apply f to the wrapped value.

Parameters
f function to apply to wrapped value
Returns
  • new wrapped value

@Deprecated public final Option<B> map (Function<A, B> f)

This method is deprecated.
since 5.0, it will be removed in 6.0; use map(Function) instead

public static Option<A> none (Class<A> type)

public static Option<A> none ()

@Deprecated public static Supplier<Option<A>> noneSupplier ()

This method is deprecated.
since 5.0, it will be removed in 6.0; use Option::none instead

public static Option<A> option (A a)

@Deprecated public static Function<A, Option<A>> option ()

This method is deprecated.
since 5.0, it will be removed in 6.0; use Option::option instead

public final Option<A> orElse (Supplier<Option<A>> orElse)

Returns this if this is a some, otherwise returns orElse.

public final Option<A> orElse (Option<A> orElse)

Returns this if this is a some, otherwise returns orElse.

@Deprecated public final Option<A> orElse (Supplier<Option<A>> orElse)

This method is deprecated.
since 5.0, it will be removed in 6.0; use orElse(Supplier) instead

public static Option<A> some (A value)

public final String toString ()

Give us feedback

Was this documentation helpful?