Two contradictory errors about Type mismatch in Java?
What on earth could be causing this? I'm getting two contradicting errors
on one method I'm trying to create in a java program
public void numberOfTrianglesIncidentToVertex(){
for(String pairs: neighbors.get(2)){ // Type mismatch: cannot
convert from element type Integer to List<Integer>
}
int fail = neighbors.get(2); // Type mismatch: cannot convert
from List<Integer> to int
}
The neighbors variable is declared in a super class as follows:
List<List<Integer>> neighbors
= new ArrayList<List<Integer>>();
I don't know why it would tell me on one line that its an Integer and
can't be converted to a List of integers and then on the very next line
just change its mind and say the exact opposite. which is it?
No comments:
Post a Comment