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.
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
Methods in com.google.common.base that return OptionalModifier and TypeMethodDescriptionstatic <T> Optional<T> Optional.absent()Returns anOptionalinstance with no contained reference.Optional.fromJavaUtil(@Nullable Optional<T> javaUtilOptional) Returns the equivalentcom.google.common.base.Optionalvalue to the givenjava.util.Optional, ornullif the argument is null.static <T> Optional<T> Optional.fromNullable(@Nullable T nullableReference) IfnullableReferenceis non-null, returns anOptionalinstance containing that reference; otherwise returnsOptional.absent().Enums.getIfPresent(Class<T> enumClass, String value) Returns an optional enum constant for the given type, usingEnum.valueOf(Class, String).static <T> Optional<T> Optional.of(T reference) Returns anOptionalinstance containing the given non-null reference.Returns thisOptionalif it has a value present;secondChoiceotherwise.abstract <V> Optional<V> If the instance is present, it is transformed with the givenFunction; otherwise,Optional.absent()is returned.Methods in com.google.common.base with parameters of type OptionalModifier and TypeMethodDescriptionReturns thisOptionalif it has a value present;secondChoiceotherwise.Optional.toJavaUtil(@Nullable Optional<T> googleOptional) Returns the equivalentjava.util.Optionalvalue to the givencom.google.common.base.Optional, ornullif 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 ofOptional.absent(). -
Uses of Optional in com.google.common.collect
Methods in com.google.common.collect that return OptionalModifier and TypeMethodDescriptionFluentIterable.first()Returns anOptionalcontaining the first element in this fluent iterable.FluentIterable.firstMatch(Predicate<? super E> predicate) Returns anOptionalcontaining the first element in this fluent iterable that satisfies the given predicate, if such an element exists.FluentIterable.last()Returns anOptionalcontaining the last element in this fluent iterable.static <T> Optional<T> Returns anOptionalcontaining the first element initerablethat satisfies the given predicate, if such an element exists.static <T> Optional<T> Returns anOptionalcontaining the first element initeratorthat 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.io
Methods in com.google.common.io that return OptionalModifier 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
Methods in com.google.common.net that return Optional