void (String[] args) { List<Example<String, Integer>> examples = List.of(); for (Example<String, Integer> example : examples) { String res = switch (example) { case Bar<Integer> v -> null; case Foo<String, Integer, ?> v -> null; }; } }