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

Method fromNullable

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

Wraps value in an Option type, depending on whether or not value is null @param value the value to wrap in Option @param the type of value @return Some(value) if value is not null, None if value is null

(T value)

Source from the content-addressed store, hash-verified

118 * @return Some(value) if value is not null, None if value is null
119 */
120 public static <T> Option<T> fromNullable(T value) {
121 if (value != null) {
122 return some(value);
123 } else {
124 return none();
125 }
126 }
127
128 /**
129 * Wrap value in a Some type (NB! value must not be null!)

Callers 2

testSomeMethod · 0.95
testNoneMethod · 0.95

Calls 2

someMethod · 0.95
noneMethod · 0.95

Tested by 2

testSomeMethod · 0.76
testNoneMethod · 0.76