Skip to content

Instantly share code, notes, and snippets.

@ruimo
Created December 13, 2018 00:03
Show Gist options
  • Save ruimo/ff9074800bc4a96817cc417a991c7216 to your computer and use it in GitHub Desktop.
Save ruimo/ff9074800bc4a96817cc417a991c7216 to your computer and use it in GitHub Desktop.
class Foo {
private final OptionalInt testPort = new Supplier<OptionalInt>() {
public OptionalInt get() {
String tp = System.getProperty("test.port");
return tp == null ? OptionalInt.empty() : OptionalInt.of(Integer.parseInt(tp));
}
}.get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment