Skip to content

Instantly share code, notes, and snippets.

@zivce
Created April 17, 2021 13:24

Revisions

  1. zivce created this gist Apr 17, 2021.
    3 changes: 3 additions & 0 deletions ifNotPresent_AnotherApproach.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    opt.<Runnable>map(value -> () -> System.out.println("Found " + value))
    .orElse(() -> System.out.println("Not present!"))
    .run();