Uses of Class
com.google.common.base.Optional
-
Packages that use Optional 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. -
-
Uses of Optional in com.google.common.base
Subclasses of Optional in com.google.common.base Modifier and Type Class Description (package private) class
Absent<T>
Implementation of anOptional
not containing a reference.(package private) class
Present<T>
Implementation of anOptional
containing a reference.Methods in com.google.common.base that return Optional Modifier and Type Method Description static <T> Optional<T>
Optional. absent()
Returns anOptional
instance with no contained reference.static <T> Optional<T>
Optional. fromJavaUtil(java.util.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()
.(package private) static <T extends java.lang.Enum<T>>
Optional<T>Platform. getEnumIfPresent(java.lang.Class<T> enumClass, java.lang.String value)
static <T extends java.lang.Enum<T>>
Optional<T>Enums. getIfPresent(java.lang.Class<T> enumClass, java.lang.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.Optional<T>
Absent. or(Optional<? extends T> secondChoice)
abstract Optional<T>
Optional. or(Optional<? extends T> secondChoice)
Returns thisOptional
if it has a value present;secondChoice
otherwise.Optional<T>
Present. or(Optional<? extends T> secondChoice)
<V> Optional<V>
Absent. transform(Function<? super T,V> function)
abstract <V> Optional<V>
Optional. transform(Function<? super T,V> function)
<V> Optional<V>
Present. transform(Function<? super T,V> function)
(package private) static <T> Optional<T>
Absent. withType()
Methods in com.google.common.base with parameters of type Optional Modifier and Type Method Description Optional<T>
Absent. or(Optional<? extends T> secondChoice)
abstract Optional<T>
Optional. or(Optional<? extends T> secondChoice)
Returns thisOptional
if it has a value present;secondChoice
otherwise.Optional<T>
Present. or(Optional<? extends T> secondChoice)
static <T> java.util.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 Optional Modifier and Type Method 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 suppliedoptionals
, in order, skipping over occurrences ofabsent()
. -
Uses of Optional in com.google.common.collect
Fields in com.google.common.collect declared as Optional Modifier and Type Field Description private Optional<java.lang.Iterable<E>>
FluentIterable. iterableDelegate
Methods in com.google.common.collect that return Optional Modifier and Type Method Description Optional<E>
FluentIterable. first()
Returns anOptional
containing the first element in this fluent iterable.Optional<E>
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.Optional<E>
FluentIterable. last()
Returns anOptional
containing the last element in this fluent iterable.static <T> Optional<T>
Iterables. tryFind(java.lang.Iterable<T> iterable, Predicate<? super T> predicate)
Returns anOptional
containing the first element initerable
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 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 Modifier and Type Method Description static <T> java.util.stream.Stream<T>
Streams. stream(Optional<T> optional)
If a value is present inoptional
, returns a stream containing only that element, otherwise returns an empty stream. -
Uses of Optional in com.google.common.graph
Fields in com.google.common.graph declared as Optional Modifier and Type Field Description (package private) Optional<java.lang.Integer>
NetworkBuilder. expectedEdgeCount
(package private) Optional<java.lang.Integer>
AbstractGraphBuilder. expectedNodeCount
-
Uses of Optional in com.google.common.io
Methods in com.google.common.io that return Optional Modifier and Type Method Description Optional<java.lang.Long>
CharSource.CharSequenceCharSource. lengthIfKnown()
Optional<java.lang.Long>
CharSource.ConcatenatedCharSource. lengthIfKnown()
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>
ByteSource.ByteArrayByteSource. sizeIfKnown()
Optional<java.lang.Long>
ByteSource.ConcatenatedByteSource. sizeIfKnown()
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>
Files.FileByteSource. sizeIfKnown()
Optional<java.lang.Long>
MoreFiles.PathByteSource. sizeIfKnown()
-
Uses of Optional in com.google.common.net
Fields in com.google.common.net declared as Optional Modifier and Type Field Description private Optional<java.nio.charset.Charset>
MediaType. parsedCharset
Methods in com.google.common.net that return Optional Modifier and Type Method Description Optional<java.nio.charset.Charset>
MediaType. 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 Optional Modifier and Type Method Description private 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.private static boolean
InternetDomainName. matchesWildcardSuffixType(Optional<PublicSuffixType> desiredType, java.lang.String domain)
Does the domain name match one of the "wildcard" patterns (e.g. -
Uses of Optional in com.google.common.testing
Methods in com.google.common.testing that return Optional Modifier and Type Method Description (package private) abstract Optional<java.lang.String>
AbstractPackageSanityTests.Chopper. chop(java.lang.String str)
private <T> Optional<T>
FreshValueGenerator. generateGoogleOptional()
private <T> Optional<T>
FreshValueGenerator. generateGoogleOptional(T value)
-
Uses of Optional in com.google.common.util.concurrent
Fields in com.google.common.util.concurrent with type parameters of type Optional Modifier and Type Field Description private java.util.List<Optional<V>>
CollectionFuture.CollectionFutureRunningState. values
Method parameters in com.google.common.util.concurrent with type arguments of type Optional Modifier and Type Method 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)
-