void () { Pair<Integer, String> pair = new Pair<>(42, "hello"); Object o = pair; if (o instanceof Pair(Integer x, String y)) { System.out.println(x + " " + y); } else { System.out.println("notCheckcastConvertible default branch"); } }