Skip to content

Instantly share code, notes, and snippets.

@soverby
Created May 17, 2018 11:59
Show Gist options
  • Save soverby/a68072f0dec35f80dba306439244302a to your computer and use it in GitHub Desktop.
Save soverby/a68072f0dec35f80dba306439244302a to your computer and use it in GitHub Desktop.
import java.util.Date;
import java.util.Optional;
public class FunctionWithCheckedException {
@FunctionalInterface
public interface SomeAppropriateSemantic<T, R> {
public R semantic(T t) throws CustomException;
};
public void method() {
SomeAppropriateSemantic<String, Date> function = string ->
new Date(Optional.ofNullable(string).orElseThrow(CustomException::new));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment