Uses of Class
com.google.common.base.Optional
Packages that use Optional
Package
Description
Basic utility libraries and interfaces.
Collection interfaces and implementations, and other utilities for collections.
An API for representing graph (node and edge) data.
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).
Testing utilities.
-
Uses of Optional in com.google.common.base
Subclasses of Optional in com.google.common.baseModifier and TypeClassDescription(package private) final class
Absent<T>
Implementation of anOptional
not containing a reference.(package private) final class
Present<T>
Implementation of anOptional
containing a reference.Methods in com.google.common.base that return OptionalModifier and TypeMethodDescriptionstatic <T> Optional
<T> Optional.absent()
Returns anOptional
instance with no contained reference.static <T> Optional
<T> Optional.fromJavaUtil
(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
(T nullableReference) IfnullableReference
is non-null, returns anOptional
instance containing that reference; otherwise returnsabsent()
.Platform.getEnumIfPresent
(Class<T> enumClass, String value) 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.<V> Optional
<V> abstract <V> Optional
<V> <V> Optional
<V> (package private) static <T> Optional
<T> Absent.withType()
Methods in com.google.common.base with parameters of type OptionalModifier and TypeMethodDescriptionReturns thisOptional
if it has a value present;secondChoice
otherwise.static <T> Optional
<T> Optional.toJavaUtil
(Optional<T> googleOptional) Returns the equivalentjava.util.Optional
value to the givencom.google.common.base.Optional
, ornull
if the argument is null.Method parameters in com.google.common.base with type arguments of type OptionalModifier 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
Fields in com.google.common.collect declared as OptionalMethods in com.google.common.collect that return OptionalModifier 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.Methods in com.google.common.collect with parameters of type Optional -
Uses of Optional in com.google.common.graph
Fields in com.google.common.graph declared as OptionalModifier and TypeFieldDescriptionNetworkBuilder.expectedEdgeCount
AbstractGraphBuilder.expectedNodeCount
-
Uses of Optional in com.google.common.io
Methods in com.google.common.io that return OptionalModifier and TypeMethodDescriptionCharSource.CharSequenceCharSource.lengthIfKnown()
CharSource.ConcatenatedCharSource.lengthIfKnown()
CharSource.lengthIfKnown()
Returns the size of this source in chars, if the size can be easily determined without actually opening the data stream.ByteSource.ByteArrayByteSource.sizeIfKnown()
ByteSource.ConcatenatedByteSource.sizeIfKnown()
ByteSource.sizeIfKnown()
Returns the size of this source in bytes, if the size can be easily determined without actually opening the data stream.ByteSource.SlicedByteSource.sizeIfKnown()
Files.FileByteSource.sizeIfKnown()
MoreFiles.PathByteSource.sizeIfKnown()
-
Uses of Optional in com.google.common.net
Fields in com.google.common.net declared as OptionalMethods in com.google.common.net that return OptionalModifier and TypeMethodDescriptionMediaType.charset()
Returns an optional charset for the value of the charset parameter if it is specified.Methods in com.google.common.net with parameters of type OptionalModifier and TypeMethodDescriptionprivate int
InternetDomainName.findSuffixOfType
(Optional<PublicSuffixType> desiredType) Returns the index of the leftmost part of the suffix, or -1 if not found.private static boolean
InternetDomainName.matchesType
(Optional<PublicSuffixType> desiredType, Optional<PublicSuffixType> actualType) If adesiredType
is specified, returns true only if theactualType
is identical. -
Uses of Optional in com.google.common.testing
Methods in com.google.common.testing that return OptionalModifier and TypeMethodDescription(package private) <T> Optional
<T> FreshValueGenerator.generateGoogleOptional()
(package private) <T> Optional
<T> FreshValueGenerator.generateGoogleOptional
(T value)