Add test method
This commit is contained in:
parent
ad7e7ec42b
commit
59b45b5f87
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user