public class Test {
record Foo(Object first, Object second) {}
public static void main(String[] args) {
Foo myfoo = new Foo(42, "millis");
switch (myfoo) {
case Foo(Integer d, String s) -> System.out.println("got integer and string: " + d + ", " + s);
case Foo(Object fs, Object sc) -> System.out.println("values: " + fs + ", " + sc);
}
}
}
record Foo(Object first, Object second) {}
public static void main(String[] args) {
Foo myfoo = new Foo(42, "millis");
switch (myfoo) {
case Foo(Integer d, String s) -> System.out.println("got integer and string: " + d + ", " + s);
case Foo(Object fs, Object sc) -> System.out.println("values: " + fs + ", " + sc);
}
}
}