EspressoOptional

public final class EspressoOptional
extends Object

java.lang.Object
   ↳ androidx.test.espresso.util.EspressoOptional<T>


This class is a wrapper around Optional in order to avoid having public references to Guava API.

See also:

Summary

Public methods

static <T> EspressoOptional<T> absent()
Set<T> asSet()
boolean equals(Object object)
static <T> EspressoOptional<T> fromNullable(T nullableReference)
T get()
int hashCode()
boolean isPresent()
static <T> EspressoOptional<T> of(T reference)
T or(Supplier<? extends T> supplier)
T or(T defaultValue)
Optional<T> or(Optional<? extends T> secondChoice)
T orNull()
static <T> Iterable<T> presentInstances(Iterable<? extends Optional<? extends T>> optionals)
String toString()
<V> Optional<V> transform(Function<? super T, V> function)

Inherited methods

Public methods

absent

public static EspressoOptional<T> absent ()

Returns
EspressoOptional<T>

asSet

public Set<T> asSet ()

Returns
Set<T>

equals

public boolean equals (Object object)

Parameters
object Object

Returns
boolean

fromNullable

public static EspressoOptional<T> fromNullable (T nullableReference)

Parameters
nullableReference T

Returns
EspressoOptional<T>

get

public T get ()

Returns
T

hashCode

public int hashCode ()

Returns
int

isPresent

public boolean isPresent ()

Returns
boolean

of

public static EspressoOptional<T> of (T reference)

Parameters
reference T

Returns
EspressoOptional<T>

or

public T or (Supplier<? extends T> supplier)

Parameters
supplier Supplier

Returns
T

or

public T or (T defaultValue)

Parameters
defaultValue T

Returns
T

or

public Optional<T> or (Optional<? extends T> secondChoice)

Parameters
secondChoice Optional

Returns
Optional<T>

orNull

public T orNull ()

Returns
T

presentInstances

public static Iterable<T> presentInstances (Iterable<? extends Optional<? extends T>> optionals)

Parameters
optionals Iterable

Returns
Iterable<T>

toString

public String toString ()

Returns
String

transform

public Optional<V> transform (Function<? super T, V> function)

Parameters
function Function

Returns
Optional<V>