Class Optional<T>


public abstract class Optional<T>
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static <T> Optional<T> absent()  
    abstract java.util.Set<T> asSet()  
    static <T> Optional<T> fromNullable​(T object)  
    abstract T get()  
    abstract T getOrThrow​(Supplier<? extends java.lang.RuntimeException> exceptionSupplier)  
    abstract T getOrThrow​(java.lang.RuntimeException e)
    Use getOrThrow(Supplier) instead (this version always instantiates the exception, no matter if needed)
    abstract boolean isPresent()  
    static <T> Optional<T> of​(T object)  
    abstract Optional<T> or​(Optional<? extends T> value)  
    abstract T or​(T value)  
    abstract T orNull()  
    abstract <U> Optional<U> transform​(Function<? super T,​U> function)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait