Uses of Class
com.google.common.base.Optional
Package
Description
Basic utility libraries and interfaces.
Collection interfaces and implementations, and other utilities for collections.
Utility methods and classes for I/O; for example input streams, output streams, readers, writers,
and files.
Utility methods and classes for networking (such as IP addresses and domain names).
-
Uses of Optional in com.google.common.base
Modifier and TypeMethodDescriptionstatic <T> Optional
<T> Optional.absent()
Returns anOptional
instance with no contained reference.Optional.fromJavaUtil
(@Nullable Optional<T> javaUtilOptional) Returns the equivalentcom.google.common.base.Optional
value to the givenjava.util.Optional
, ornull
if the argument is null.static <T> Optional
<T> Optional.fromNullable
(@Nullable T nullableReference) IfnullableReference
is non-null, returns anOptional
instance containing that reference; otherwise returnsabsent()
.Enums.getIfPresent
(Class<T> enumClass, String value) Returns an optional enum constant for the given type, usingEnum.valueOf(java.lang.Class<T>, java.lang.String)
.static <T> Optional
<T> Optional.of
(T reference) Returns anOptional
instance containing the given non-null reference.Returns thisOptional
if it has a value present;secondChoice
otherwise.abstract <V> Optional
<V> Modifier and TypeMethodDescriptionReturns thisOptional
if it has a value present;secondChoice
otherwise.Optional.toJavaUtil
(@Nullable Optional<T> googleOptional) Returns the equivalentjava.util.Optional
value to the givencom.google.common.base.Optional
, ornull
if the argument is null.Modifier and TypeMethodDescriptionstatic <T> Iterable
<T> Optional.presentInstances
(Iterable<? extends Optional<? extends T>> optionals) Returns the value of each present instance from the suppliedoptionals
, in order, skipping over occurrences ofabsent()
. -
Uses of Optional in com.google.common.collect
Modifier and TypeMethodDescriptionFluentIterable.first()
Returns anOptional
containing the first element in this fluent iterable.FluentIterable.firstMatch
(Predicate<? super E> predicate) Returns anOptional
containing the first element in this fluent iterable that satisfies the given predicate, if such an element exists.FluentIterable.last()
Returns anOptional
containing the last element in this fluent iterable.static <T> Optional
<T> Returns anOptional
containing the first element initerable
that satisfies the given predicate, if such an element exists.static <T> Optional
<T> Returns anOptional
containing the first element initerator
that satisfies the given predicate, if such an element exists. -
Uses of Optional in com.google.common.io
Modifier and TypeMethodDescriptionCharSource.lengthIfKnown()
Returns the size of this source in chars, if the size can be easily determined without actually opening the data stream.ByteSource.sizeIfKnown()
Returns the size of this source in bytes, if the size can be easily determined without actually opening the data stream. -
Uses of Optional in com.google.common.net