T
- The type of the value represented by this instancepublic final class None<T> extends Object implements Option<T>, Serializable
Option
.DEFAULT_NONE
Constructor and Description |
---|
None() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Always returns
true as None is stateless comparing it to some other None is therefore always the same. |
boolean |
exists(java.util.function.Predicate<T> p)
Always returns
false . |
T |
get()
Always throws
NoSuchElementException since None cannot hold any value. |
T |
getOrElse(java.util.function.Supplier<T> s)
Always the value provided by the supplier.
|
int |
hashCode()
Always returns
0 as None is stateless and has no value. |
<R> Option<R> |
map(java.util.function.Function<T,R> f)
Always returns
this . |
Option<T> |
orElse(java.util.function.Supplier<Option<T>> s)
Always the value provided by the supplier.
|
java.util.stream.Stream<T> |
stream()
Always returns an empty stream.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
apply, asOptional, contains, count, empty, filter, filterNot, forall, isDefined, isEmpty, iterator, ofOptional, orNull
forEach, spliterator
public T get()
NoSuchElementException
since None cannot hold any value.public T getOrElse(java.util.function.Supplier<T> s)
public boolean exists(java.util.function.Predicate<T> p)
false
.public <R> Option<R> map(java.util.function.Function<T,R> f)
this
.public Option<T> orElse(java.util.function.Supplier<Option<T>> s)
public java.util.stream.Stream<T> stream()
public boolean equals(Object other)
true
as None is stateless comparing it to some other None is therefore always the same.public int hashCode()
0
as None is stateless and has no value.Copyright © 2015. All rights reserved.