T
- The type of the optional value.public static final class Option.Some<T> extends Object implements Option<T>, Serializable
Option
. It contains a value which may be null. However, to
create an Option containing null, new Some(null)
has to be called. In all other cases
Option.of(Object)
is sufficient.Option.None<T>, Option.Some<T>
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Clarifies that values have a proper equals() method implemented.
|
T |
get()
Gets the value if this is a
Some or throws if this is a None . |
int |
hashCode()
Clarifies that values have a proper hashCode() method implemented.
|
boolean |
isEmpty()
Returns true, if this is
None , otherwise false, if this is Some . |
String |
stringPrefix()
Returns the name of this Value type, which is used by toString().
|
String |
toString()
Clarifies that values have a proper toString() method implemented.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
collect, filter, flatMap, fold, getOrElse, getOrElse, getOrElseThrow, isAsync, isDefined, isLazy, isSingleValued, iterator, map, narrow, none, of, ofOptional, onEmpty, orElse, orElse, peek, sequence, some, transform, traverse, when, when
collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElseTry, getOrNull, narrow, out, out, spliterator, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
public T get()
Option
Some
or throws if this is a None
.public boolean isEmpty()
Option
None
, otherwise false, if this is Some
.public boolean equals(Object obj)
Value
public int hashCode()
Value
See Object.hashCode().
public String stringPrefix()
Value
stringPrefix
in interface Value<T>
public String toString()
Value
See Object.toString().
Copyright © 2020. All Rights Reserved.