Skip to content

Instantly share code, notes, and snippets.

@pmartycz
Last active August 23, 2018 17:16
Show Gist options
  • Save pmartycz/fca23ea31511c37ac0ed3ce58ba1a125 to your computer and use it in GitHub Desktop.
Save pmartycz/fca23ea31511c37ac0ed3ce58ba1a125 to your computer and use it in GitHub Desktop.
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