MCPcopy Create free account
hub / github.com/apache/thrift / toOptional

Method toOptional

lib/java/src/main/java/org/apache/thrift/Option.java:65–71  ·  view source on GitHub ↗

Turn this Option into Java 8 Optional type @return Java 8+ Optional Type

()

Source from the content-addressed store, hash-verified

63 * @return Java 8+ Optional Type
64 */
65 public Optional<T> toOptional() {
66 if (isDefined()) {
67 return Optional.of(get());
68 } else {
69 return Optional.empty();
70 }
71 }
72
73 /** The None type, representing an absent value (instead of "null") */
74 public static class None<T> extends Option<T> {

Callers

nothing calls this directly

Calls 4

isDefinedMethod · 0.95
getMethod · 0.95
ofMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected