class X { void testDominance1(Object obj) { switch (obj) { default -> System.out.println("default"); case Integer i -> System.out.println("Integer"); case String s when s.isEmpty() -> System.out.println("empty String"); case null -> System.out.println("null"); } } void testDominance2(Object obj) { switch (obj) { case null, default -> System.out.println("null or default"); case Integer i -> System.out.println("Integer"); case String s when s.isEmpty() -> System.out.println("empty String"); } } void testDominance3(String s) { switch (s) { default -> System.out.println("default"); case "blah blah blah" -> System.out.println("blah blah blah"); case null -> System.out.println("null"); } } void testDominance4(String s) { switch (s) { case null, default -> System.out.println("null, default"); case "blah blah blah" -> System.out.println("blah blah blah"); } } void testUnconditionalPatternAndDefault1(String s) { switch (s) { case null, default -> System.out.println("null, default"); case String str -> System.out.println("String"); } } void testUnconditionalPatternAndDefault2(Integer j) { switch (j) { case Integer i when true -> System.out.println("An integer"); default -> System.out.println("default"); } } void testDuplicateUnconditionalPattern1(Integer j) { switch (j) { case Integer i when true -> System.out.println("An integer"); case Number number -> System.out.println("An integer"); } } void testDuplicateUnconditionalPattern2(Integer j) { switch (j) { case Integer i when true -> System.out.println("An integer"); case Integer i -> System.out.println("An integer"); } } }