I'm pretty confused... I know that I can store an ArrayList of Lists on a List of Lists;
I have an object like this:
SemanticTuple< List<String>, List<List<String>> > object;
I can do this:
List<List<String>> list = new ArrayList<>();
object = new SemanticTuple<>("name", Arrays.asList(header.split(headerSplitter)), list);
But I can't do this:
object = new SemanticTuple<>("name", Arrays.asList(header.split(headerSplitter)), new ArrayList<>());
Why does it can't recognize the type there?
update
public class SemanticTuple <HASH, DATA> implements Serializable {
private String name;
private HASH hash;
private DATA Data;
public SemanticTuple() {
}
public SemanticTuple(String name, HASH hash, DATA Data) {
this.name = name;
this.hash = hash;
this.Data = Data;
}
...
Object is declared as generic from another class:
public class MeteorologicTask extends Task < LineNumberReader,
SemanticTuple< List<String>, List<List<String>> >,
SemanticTuple< List<String>, List<List<String>> > >{
...
from...
public abstract class Task <RESOURCE, INPUT, OUTPUT> implements Callable<OUTPUT>{
protected RESOURCE resource;
protected INPUT input;
protected OUTPUT output;
protected Integer taskID;
public Task() {
}
public Task(RESOURCE resource, Integer taskID) {
this.resource = resource;
this.taskID = taskID;
}
...
An image:

SemanticTupleis declared, b) how the constructor forSemanticTupleis declared, c) howobjectis declared, d) what version of Java you are using (Java 8 has much better type inference).