Add new test classes
This commit is contained in:
parent
e5f03369cc
commit
5a151a965c
@ -0,0 +1,23 @@
|
||||
import java.util.List;
|
||||
import java.lang.String;
|
||||
|
||||
public final class TestClassWildcardsParamType<T1, T2> {
|
||||
public final T1 first;
|
||||
public final T2 second;
|
||||
|
||||
public TestClassWildcardsParamType(T1 first, T2 second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
public static <T1, T2> TestClassWildcardsParamType<T1, T2> of(T1 first, T2 second) {
|
||||
return new TestClassWildcardsParamType<T1, T2>(first, second);
|
||||
}
|
||||
|
||||
public static void main(String[] agrs) {
|
||||
TestClassWildcardsParamType<Class<?>, String> pair = TestClassWildcardsParamType.of(List.class, "hello");
|
||||
|
||||
//Outout of compiler
|
||||
//TestClassWildcardsParamType<? extends Class<?>, String> pair = TestClassWildcardsParamType.of(List.class, "hello");
|
||||
}
|
||||
}
|
@ -5,9 +5,6 @@ import java.lang.Object;
|
||||
class TestClassWildcardsSingle
|
||||
{
|
||||
|
||||
public TestClassWildcards () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non working method in normal Java
|
||||
* @param input
|
||||
|
@ -0,0 +1,10 @@
|
||||
import java.util.List;
|
||||
|
||||
class TestClassWildcardsLib
|
||||
{
|
||||
|
||||
public <T> List<T> merge (List<T> l1, List<T> l2) {
|
||||
l2.forEach(s -> {if(!l1.contains(s)) l1.add(s);});
|
||||
return l2;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user