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; import java.util.ArrayList;
class TestClassWildcards { class TestClassWildcards
{
private List<String> field1; private List<String> field1;
private int counter; private int counter;
public TestClassWildcards(){ public TestClassWildcards () {
field1 = new ArrayList<>(); field1 = new ArrayList<>();
counter = 0; counter = 0;
} }
public List<String> test(List<String> param1){ /**
List<String> localVar = field1; * Working method for Java
field1 = param; * @param param1
* @return
*/
public List<String> test (List<String> param1) {
List<String> localVar = field1;
field1 = param;
counter++; 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;
}
} }