Last active
December 6, 2017 17:08
-
-
Save poetix/828654fae68955c4d04652c064c4df34 to your computer and use it in GitHub Desktop.
Revisions
-
poetix revised this gist
Dec 6, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ public String ofNullableExample(Map<String, String> map) { return Optional.ofNullable(map.get(key)) .orElseThrow(() -> new ItemNotFoundException(key)); } public String nullCheckingExample(Map<String, String> map) { -
poetix created this gist
Dec 6, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ public String ofNullableExample(Map<String, String> map) { return Optional.ofNullable(map.get(key)).orElseThrow(() -> new ItemNotFoundException(key)); } public String nullCheckingExample(Map<String, String> map) { String valueAtKey = map.get(key); if (valueAtKey == null) { throw new ItemNotFoundException(key); } return valueAtKey; }