Add diamond expression

This commit is contained in:
Till Schnell 2021-04-16 19:34:49 +02:00
parent cd2f030ac6
commit f3dc0cbeb7

View File

@ -11,13 +11,13 @@ public final class TestClassWildcardsParamType<T1, T2> {
}
public static <T1, T2> TestClassWildcardsParamType<T1, T2> of(T1 first, T2 second) {
return new TestClassWildcardsParamType<T1, T2>(first, second);
return new TestClassWildcardsParamType<>(first, second);
}
public static void main(String[] agrs) {
TestClassWildcardsParamType<Class<?>, String> pair = TestClassWildcardsParamType.of(List.class, "hello");
//Outout of compiler
//Output of compiler
//TestClassWildcardsParamType<? extends Class<?>, String> pair = TestClassWildcardsParamType.of(List.class, "hello");
}
}