Package | Description |
---|---|
com.google.common.base |
Basic utility libraries and interfaces.
|
com.google.common.collect |
This package contains generic collection interfaces and implementations, and
other utilities for working with collections.
|
Modifier and Type | Method and Description |
---|---|
static <T> Optional<T> |
Optional.absent()
Returns an
Optional instance with no contained reference. |
static <T> Optional<T> |
Optional.fromNullable(T nullableReference)
If
nullableReference is non-null, returns an Optional instance containing that
reference; otherwise returns absent() . |
static <T> Optional<T> |
Optional.of(T reference)
Returns an
Optional instance containing the given non-null reference. |
abstract Optional<T> |
Optional.or(Optional<? extends T> secondChoice)
Returns this
Optional if it has a value present; secondChoice
otherwise. |
Modifier and Type | Method and Description |
---|---|
abstract Optional<T> |
Optional.or(Optional<? extends T> secondChoice)
Returns this
Optional if it has a value present; secondChoice
otherwise. |
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
Optional.presentInstances(Iterable<Optional<T>> optionals)
Returns the value of each present instance from the supplied
optionals , in order,
skipping over occurrences of absent() . |
Modifier and Type | Method and Description |
---|---|
static <T> Optional<T> |
Iterables.tryFind(Iterable<T> iterable,
Predicate<? super T> predicate)
Returns an
Optional containing the first element in iterable that satisfies the given predicate, if such an element exists. |
static <T> Optional<T> |
Iterators.tryFind(Iterator<T> iterator,
Predicate<? super T> predicate)
Returns an
Optional containing the first element in iterator that satisfies the given predicate, if such an element exists. |
Copyright © 2010-2012. All Rights Reserved.