public abstract class Optional<T> extends Object
| 修飾子とタイプ | クラスと説明 |
|---|---|
static class |
Optional.Empty<U> |
static class |
Optional.Present<U> |
| コンストラクタと説明 |
|---|
Optional() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static <U> Optional<U> |
empty() |
abstract T |
get() |
abstract void |
ifEmpty(Runnable consumer) |
abstract void |
ifPresent(Consumer<T> consumer) |
abstract boolean |
isEmpty() |
abstract <U> Optional<U> |
map(Function<T,U> f) |
static <U> Optional<U> |
of(U value) |
static <U> Optional<U> |
ofNullable(U value) |
abstract T |
orElse(T elseValue) |
abstract void |
presentOrEmpty(Consumer<T> present,
Runnable empty) |
public static <U> Optional<U> of(U value)
public static <U> Optional<U> ofNullable(U value)
public static final <U> Optional<U> empty()
public abstract boolean isEmpty()
public abstract void ifEmpty(Runnable consumer)
public abstract T get() throws NoSuchElementException
Copyright © 2016. All rights reserved.