Created
January 3, 2019 15:21
-
-
Save scottashipp/6a1ce1ac7ba9737a004e0d007844359e to your computer and use it in GitHub Desktop.
Use of Optional in place of a null-check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Optional handle = (Optional)JAVA_9_PROCESSHANDLE_OF.invoke(null, pid); | |
if (handle.isPresent()) { | |
JAVA_9_PROCESSHANDLE_DESTROY.invoke(handle.get()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment