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.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). -
-
Uses of Optional in com.google.common.base
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. fromNullable(T nullableReference)
IfnullableReference
is non-null, returns anOptional
instance containing that reference; otherwise returnsabsent()
.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.abstract Optional<T>
Optional. or(Optional<? extends T> secondChoice)
Returns thisOptional
if it has a value present;secondChoice
otherwise.abstract <V> Optional<V>
Optional. transform(Function<? super T,V> function)
Methods in com.google.common.base with parameters of type Optional Modifier and Type Method Description abstract Optional<T>
Optional. or(Optional<? extends T> secondChoice)
Returns thisOptional
if it has a value present;secondChoice
otherwise.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
Methods in com.google.common.collect that return Optional Modifier and Type Method Description Optional<@NonNull E>
FluentIterable. first()
Returns anOptional
containing the first element in this fluent iterable.Optional<@NonNull 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<@NonNull 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. -
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. 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. 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
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.
-