T
- The type of the value represented by this instancepublic final class Some<T> extends Object implements Option<T>, Serializable
Option
holding a value.DEFAULT_NONE
Constructor and Description |
---|
Some(T value)
Creates an instance for the provided value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
|
boolean |
exists(java.util.function.Predicate<T> p)
Returns
true if the predicate matches the value. |
<R> Option<R> |
flatMap(java.util.function.Function<T,Option<R>> function)
Returns an Option consisting of the result of applying the given function to the current value.
|
T |
get()
Always returns the value.
|
T |
getOrElse(java.util.function.Supplier<T> s)
Always returns the value.
|
int |
hashCode()
Returns the hashCode based on the value of this
Some . |
<R> Option<R> |
map(java.util.function.Function<T,R> f)
Returns an Option consisting of the result of applying the given function to the current value.
|
Option<T> |
orElse(java.util.function.Supplier<Option<T>> s)
Always returns
this . |
java.util.stream.Stream<T> |
stream()
Returns a stream of size one containing the value.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
apply, asOptional, contains, count, empty, filter, filterNot, forall, isDefined, isEmpty, iterator, None, ofOptional, orNull
forEach, spliterator
public Some(T value)
value
- The value represented by this Somepublic boolean exists(java.util.function.Predicate<T> p)
true
if the predicate matches the value.public T get()
public T getOrElse(java.util.function.Supplier<T> s)
public <R> Option<R> map(java.util.function.Function<T,R> f)
public <R> Option<R> flatMap(java.util.function.Function<T,Option<R>> function)
public Option<T> orElse(java.util.function.Supplier<Option<T>> s)
this
.public java.util.stream.Stream<T> stream()
public boolean equals(Object other)
public int hashCode()
Some
.Copyright © 2015. All rights reserved.