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 Collection interfaces and implementations, and other utilities for collections.com.google.common.io Utility methods and classes for I/O; for example input streams, output streams, readers, writers, and files.com.google.common.net 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 Optional Modifier and Type Method Description static <T> Optional<T>Optional. absent()Returns anOptionalinstance with no contained reference.static <T> Optional<T>Optional. fromJavaUtil(java.util.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(T nullableReference)IfnullableReferenceis non-null, returns anOptionalinstance 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 anOptionalinstance containing the given non-null reference.abstract Optional<T>Optional. or(Optional<? extends T> secondChoice)Returns thisOptionalif it has a value present;secondChoiceotherwise.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 thisOptionalif it has a value present;secondChoiceotherwise.static <T> java.util.Optional<T>Optional. toJavaUtil(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 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 anOptionalcontaining the first element in this fluent iterable.Optional<@NonNull E>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.Optional<@NonNull E>FluentIterable. last()Returns anOptionalcontaining the last element in this fluent iterable.static <T> Optional<T>Iterables. tryFind(java.lang.Iterable<T> iterable, Predicate<? super T> predicate)Returns anOptionalcontaining the first element initerablethat 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 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 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.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.
-