| 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.
|
| com.google.common.net |
This package contains utility methods and classes for working with net addresses (numeric IP and domain names).
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Optional |
Optional.absent()
Returns an
Optional instance with no contained reference.
|
static <T> Optional |
Optional.fromNullable(T nullableReference)
If
nullableReference is non-null, returns an
Optional instance containing that reference; otherwise returns
absent().
|
static <T extends Enum |
Enums.getIfPresent(Class
Returns an optional enum constant for the given type, using
Enum.
|
static <T> Optional |
Optional.of(T reference)
Returns an
Optional instance containing the given non-null reference.
|
abstract Optional |
Optional.or(Optional
Returns this
Optional if it has a value present;
secondChoice otherwise.
|
abstract <V> Optional |
Optional.transform(Function
|
| Modifier and Type | Method and Description |
|---|---|
abstract Optional |
Optional.or(Optional
Returns this
Optional if it has a value present;
secondChoice otherwise.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Iterable |
Optional.presentInstances(Iterable
Returns the value of each present instance from the supplied
optionals, in order, skipping over occurrences of
absent().
|
| Modifier and Type | Method and Description |
|---|---|
Optional |
FluentIterable.first()
Returns an
Optional containing the first element in this fluent iterable.
|
Optional |
FluentIterable.firstMatch(Predicate
Returns an
Optional containing the first element in this fluent iterable that satisfies the given predicate, if such an element exists.
|
Optional |
FluentIterable.last()
Returns an
Optional containing the last element in this fluent iterable.
|
abstract Optional |
BinaryTreeTraverser.leftChild(T root)
Returns the left child of the specified node, or
absent() if the specified node has no left child.
|
abstract Optional |
BinaryTreeTraverser.rightChild(T root)
Returns the right child of the specified node, or
absent() if the specified node has no right child.
|
static <T> Optional |
Iterables.tryFind(Iterable
Returns an
Optional containing the first element in
iterable that satisfies the given predicate, if such an element exists.
|
static <T> Optional |
Iterators.tryFind(Iterator
Returns an
Optional containing the first element in
iterator that satisfies the given predicate, if such an element exists.
|
| Modifier and Type | Method and Description |
|---|---|
Optional |
MediaType.charset()
Returns an optional charset for the value of the charset parameter if it is specified.
|