T - The type of the optional value.@Deprecated public static final class Option.Some<T> extends Option<T> implements java.io.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(java.lang.Object obj)
Deprecated.
Clarifies that values have a proper equals() method implemented.
|
T |
get()
Deprecated.
Gets the value if this is a
Some or throws if this is a None. |
int |
hashCode()
Deprecated.
Clarifies that values have a proper hashCode() method implemented.
|
boolean |
isEmpty()
Deprecated.
Returns true, if this is
None, otherwise false, if this is Some. |
java.lang.String |
stringPrefix()
Deprecated.
Returns the name of this Value type, which is used by toString().
|
java.lang.String |
toString()
Deprecated.
Clarifies that values have a proper toString() method implemented.
|
collect, filter, filterNot, flatMap, fold, getOrElse, getOrElse, getOrElseThrow, isAsync, isDefined, isLazy, isSingleValued, iterator, map, narrow, none, of, ofOptional, onEmpty, orElse, orElse, orNull, peek, peek, sequence, some, transform, traverse, when, whenclone, finalize, getClass, notify, notifyAll, wait, wait, waitcollect, 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, toVectorpublic T get()
OptionSome or throws if this is a None.
// Prints "57"
System.out.println(Option.of(57).get());
// Throws a NoSuchElementException
Option.none().get();
public boolean isEmpty()
OptionNone, otherwise false, if this is Some.
// Prints "false"
System.out.println(Option.of(10).isEmpty());
// Prints "true"
System.out.println(Option.none().isEmpty());
public boolean equals(java.lang.Object obj)
Valuepublic int hashCode()
ValueSee Object.hashCode().
public java.lang.String stringPrefix()
ValuestringPrefix in interface Value<T>public java.lang.String toString()
ValueSee Object.toString().