I just touch java, I found if I need to create a new list
List<String> a = new ArrayList<String>();
But in my homework, the code is like following. In the function Postering, the parameter is List<Integer> positions
. Can we put 'ArrayList' there? Or usually we usually put
List there?
Could someone explain this in a detailed way?
static class Posting {
int docID;
List<Integer> positions;
public Posting(int docID, List<Integer> positions) {
this.docID = docID;
this.positions = positions;
}
}