Look at this code:
/* Implementation to populate List<String[]> schedule */
public List<String[]> getSchedBySIN(String sin) {
List<String[]> listBySin = null;
for (String[] temp : schedule) {
if(temp[0].equals(sin)) listBySin.add(temp);
}
return listBySin;
}
listBySin on the line ...listBySin.add(temp); is underlined with color yellow and Eclipse tells me this: Null pointer access: The variable listBySin can only be null at this location
Why is that? What I want to do is populate listBySin with string arrays from schedule if their first element is equal to sin.
You need to assign a
Listobject to the var.