Java com.google.common.base Optional fields, constructors, methods, implement or subclass

Example usage for Java com.google.common.base Optional fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for com.google.common.base Optional.

The text is from its open source code.

Implementation

com.google.common.base.Optional has the following implementations.
Click this link to see all its implementation.

Method

Optionalabsent()
Returns an Optional instance with no contained reference.
SetasSet()
Returns an immutable singleton Set whose only element is the contained instance if it is present; an empty immutable Set otherwise.
booleanequals(@Nullable Object object)
Returns true if object is an Optional instance, and either the contained references are Object#equals equal to each other or both are absent.
OptionalfromNullable(@Nullable T nullableReference)
If nullableReference is non-null, returns an Optional instance containing that reference; otherwise returns Optional#absent .
Tget()
Returns the contained instance, which must be present.
inthashCode()
Returns a hash code for this instance.
booleanisPresent()
Returns true if this holder contains a (non-null) instance.
Optionalof(T reference)
Returns an Optional instance containing the given non-null reference.
Tor(T defaultValue)
Returns the contained instance if it is present; defaultValue otherwise.
Optionalor(Optional secondChoice)
Returns this Optional if it has a value present; secondChoice otherwise.
Tor(Supplier supplier)
Returns the contained instance if it is present; supplier.get() otherwise.
TorNull()
Returns the contained instance if it is present; null otherwise.
IterablepresentInstances(final Iterable> optionals)
Returns the value of each present instance from the supplied optionals , in order, skipping over occurrences of Optional#absent .
StringtoString()
Returns a string representation for this instance.
Optionaltransform(Function function)
If the instance is present, it is transformed with the given Function ; otherwise, Optional#absent is returned.