Last active
August 23, 2018 17:16
-
-
Save pmartycz/fca23ea31511c37ac0ed3ce58ba1a125 to your computer and use it in GitHub Desktop.
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
package com.example.demo; | |
import java.util.Optional; | |
import java.util.function.Function; | |
import java.util.function.UnaryOperator; | |
public class LogOptional { | |
public static void main(String[] args) { | |
UnaryOperator<?> log = x -> { | |
System.out.println(x); | |
return x; | |
}; | |
Optional.of("one").map(log); | |
Optional.of(5).map(log); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment