Jimexist commented on a change in pull request #2524:
URL: https://github.com/apache/thrift/pull/2524#discussion_r818358411



##########
File path: lib/java/src/org/apache/thrift/Option.java
##########
@@ -54,6 +56,19 @@ public T or(T other) {
             return other;
         }
     }
+
+    /**
+     * Turn this Option into Java 8 Optional type
+     * @return Java 8+ Optional Type
+     */
+    public Optional<T> toOptional() {
+        if (isDefined()) {
+            return Optional.of(get());
+        } else {
+            return Optional.empty();
+        }

Review comment:
       I'd keep this as is because it is more explicit while the proposed 
change results in two if-comparison, one in here and another in the optional 
class itself 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to