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.graph |
An API for representing graph (node and edge) data.
|
com.google.common.io |
This package contains utility methods and classes for working with Java I/O; for example input
streams, output streams, readers, writers, and files.
|
com.google.common.net |
This package contains utility methods and classes for working with net addresses (numeric IP and
domain names).
|
com.google.common.testing |
This package contains testing utilities.
|
com.google.common.util.concurrent |
Concurrency utilities.
|
Modifier and Type | Class and Description |
---|---|
(package private) class |
Absent<T>
Implementation of an
Optional not containing a reference. |
(package private) class |
Present<T>
Implementation of an
Optional containing a reference. |
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() . |
(package private) static <T extends java.lang.Enum<T>> |
Platform.getEnumIfPresent(java.lang.Class<T> enumClass,
java.lang.String value) |
static <T extends java.lang.Enum<T>> |
Enums.getIfPresent(java.lang.Class<T> enumClass,
java.lang.String value)
Returns an optional enum constant for the given type, using
Enum.valueOf(java.lang.Class<T>, java.lang.String) . |
static <T> Optional<T> |
Optional.of(T reference)
Returns an
Optional instance containing the given non-null reference. |
Optional<T> |
Present.or(Optional<? extends T> secondChoice) |
Optional<T> |
Absent.or(Optional<? extends T> secondChoice) |
abstract Optional<T> |
Optional.or(Optional<? extends T> secondChoice)
Returns this
Optional if it has a value present; secondChoice otherwise. |
<V> Optional<V> |
Present.transform(Function<? super T,V> function) |
<V> Optional<V> |
Absent.transform(Function<? super T,V> function) |
abstract <V> Optional<V> |
Optional.transform(Function<? super T,V> function)
|
(package private) static <T> Optional<T> |
Absent.withType() |
Modifier and Type | Method and Description |
---|---|
Optional<T> |
Present.or(Optional<? extends T> secondChoice) |
Optional<T> |
Absent.or(Optional<? extends T> secondChoice) |
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> java.lang.Iterable<T> |
Optional.presentInstances(java.lang.Iterable<? extends Optional<? extends T>> optionals)
Returns the value of each present instance from the supplied
optionals , in order,
skipping over occurrences of absent() . |
Modifier and Type | Field and Description |
---|---|
private Optional<java.lang.Iterable<E>> |
FluentIterable.iterableDelegate |
Modifier and Type | Method and Description |
---|---|
Optional<E> |
FluentIterable.first()
Returns an
Optional containing the first element in this fluent iterable. |
Optional<E> |
FluentIterable.firstMatch(Predicate<? super E> predicate)
Returns an
Optional containing the first element in this fluent iterable that satisfies
the given predicate, if such an element exists. |
Optional<E> |
FluentIterable.last()
Returns an
Optional containing the last element in this fluent iterable. |
abstract Optional<T> |
BinaryTreeTraverser.leftChild(T root)
Returns the left child of the specified node, or
absent() if the specified
node has no left child. |
abstract Optional<T> |
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<T> |
Iterables.tryFind(java.lang.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(java.util.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. |
Modifier and Type | Method and Description |
---|---|
private static <T> void |
BinaryTreeTraverser.pushIfPresent(java.util.Deque<T> stack,
Optional<T> node) |
Modifier and Type | Field and Description |
---|---|
(package private) Optional<java.lang.Integer> |
NetworkBuilder.expectedEdgeCount |
(package private) Optional<java.lang.Integer> |
AbstractGraphBuilder.expectedNodeCount |
Modifier and Type | Method and Description |
---|---|
Optional<java.lang.Long> |
CharSource.lengthIfKnown()
Returns the size of this source in chars, if the size can be easily determined without actually
opening the data stream.
|
Optional<java.lang.Long> |
CharSource.CharSequenceCharSource.lengthIfKnown() |
Optional<java.lang.Long> |
CharSource.ConcatenatedCharSource.lengthIfKnown() |
Optional<java.lang.Long> |
ByteSource.sizeIfKnown()
Returns the size of this source in bytes, if the size can be easily determined without actually
opening the data stream.
|
Optional<java.lang.Long> |
ByteSource.SlicedByteSource.sizeIfKnown() |
Optional<java.lang.Long> |
ByteSource.ByteArrayByteSource.sizeIfKnown() |
Optional<java.lang.Long> |
ByteSource.ConcatenatedByteSource.sizeIfKnown() |
Optional<java.lang.Long> |
Files.FileByteSource.sizeIfKnown() |
Modifier and Type | Method and Description |
---|---|
Optional<java.nio.charset.Charset> |
MediaType.charset()
Returns an optional charset for the value of the charset parameter if it is specified.
|
Modifier and Type | Method and Description |
---|---|
(package private) abstract Optional<java.lang.String> |
AbstractPackageSanityTests.Chopper.chop(java.lang.String str) |
private <T> Optional<T> |
FreshValueGenerator.generateOptional() |
private <T> Optional<T> |
FreshValueGenerator.generateOptional(T value) |
Modifier and Type | Field and Description |
---|---|
private java.util.List<Optional<V>> |
CollectionFuture.CollectionFutureRunningState.values |
Modifier and Type | Method and Description |
---|---|
(package private) abstract C |
CollectionFuture.CollectionFutureRunningState.combine(java.util.List<Optional<V>> values) |
java.util.List<V> |
CollectionFuture.ListFuture.ListFutureRunningState.combine(java.util.List<Optional<V>> values) |