Ola pessoal,
Estou estudando o funcionamento dos WildCards, mas estou com uma duvida, aonde eu comentei como SAMPLE 3 gostaria de saber
oque que eu posso colocar dentro daquelas duas listas , e se alguem pudesse me dar um exemplo de codigo agradeceria, pois ja tentei algumas coisas e nao deu certo.
import java.util.ArrayList;
import java.util.List;
public class Collections2 {
public static void main(String[] args) {
//SAMPLE 1
List<Integer> arrayInteger = new ArrayList<Integer>();
arrayInteger.add(1);
arrayInteger.add(2);
arrayInteger.add(3);
List<List<Integer>> table = new ArrayList<List<Integer>>();
table.add(arrayInteger);
//SAMPLE 2
Collections2 c1 = new Collections2();
Collections2 c2 = new Collections2();
List<Object> arrayObject = new ArrayList<Object>();
arrayObject.add(c1);
arrayObject.add(c2);
List<List<Object>> tableObj = new ArrayList<List<Object>>();
tableObj.add(arrayObject);
//SAMPLE 3
List<? extends List< Number>> tableNumber = new ArrayList();
//tableNumber.add(table);
List<List<? extends Number>> tableNumber2 = new ArrayList();
}
}