dotfiles
bugabingas dorkfiles
owned by bugabinga
pi/skill-library/java/java-unnamed-variables-patterns/examples/jep-456.md
Raw
Source: https://openjdk.org/jeps/456
try {
parse(input);
} catch (NumberFormatException _) {
return Optional.empty();
}
record Point(int x, int y) {}
record ColoredPoint(Point p, String color) {}
if (obj instanceof ColoredPoint(Point(int x, _), _)) {
System.out.println(x);
}
Markdown source
File outline
# [JEP 456](https://openjdk.org/jeps/456) examples
Source: https://openjdk.org/jeps/456
```java
try {
parse(input);
} catch (NumberFormatException _) {
return Optional.empty();
}
```
```java
record Point(int x, int y) {}
record ColoredPoint(Point p, String color) {}
if (obj instanceof ColoredPoint(Point(int x, _), _)) {
System.out.println(x);
}
```