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 anOptionalinstance with no contained reference.static <T> Optional<T>Optional. fromJavaUtil(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 Enum<T>>
Optional<T>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 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> 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> 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
Methods in com.google.common.collect that return Optional Modifier and Type Method Description Optional<E>FluentIterable. first()Returns anOptionalcontaining the first element in this fluent iterable.Optional<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<E>FluentIterable. last()Returns anOptionalcontaining the last element in this fluent iterable.static <T> Optional<T>Iterables. tryFind(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(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> 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<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<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<Charset>MediaType. charset()Returns an optional charset for the value of the charset parameter if it is specified.
-