Add test method
This commit is contained in:
parent
ad7e7ec42b
commit
59b45b5f87
@ -1,6 +1,7 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
class TestClassWildcards {
|
||||
class TestClassWildcards
|
||||
{
|
||||
|
||||
private List<String> field1;
|
||||
private int counter;
|
||||
@ -10,6 +11,11 @@ class TestClassWildcards {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Working method for Java
|
||||
* @param param1
|
||||
* @return
|
||||
*/
|
||||
public List<String> test (List<String> param1) {
|
||||
List<String> localVar = field1;
|
||||
field1 = param;
|
||||
@ -17,4 +23,16 @@ class TestClassWildcards {
|
||||
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