Add test method

This commit is contained in:
Till Schnell 2021-03-27 18:04:28 +01:00
parent ad7e7ec42b
commit 59b45b5f87

View File

@ -1,20 +1,38 @@
import java.util.ArrayList;
class TestClassWildcards {
class TestClassWildcards
{
private List<String> field1;
private List<String> field1;
private int counter;
public TestClassWildcards(){
field1 = new ArrayList<>();
public TestClassWildcards () {
field1 = new ArrayList<>();
counter = 0;
}
}
public List<String> test(List<String> param1){
List<String> localVar = field1;
field1 = param;
/**
* Working method for Java
* @param param1
* @return
*/
public List<String> test (List<String> param1) {
List<String> localVar = field1;
field1 = param;
counter++;
return localVar;
}
return localVar;
}
/**
* Non working method in normal Java
* @param input
* @return
*/
public List<Object> test2 (List<String> input) {
List<Object> listOfObjects = input;
Object test = listOfObjects.get(0);
String string = "Test";
input.add(string);
return listOfObjects;
}
}