I’m getting the following error on the line where it says ht.keySet():
Type mismatch: cannot convert from element type Object to int
ht is a LinkedHashMap.
for (int key : ht.keySet())
{
if(ht.get(key).size() == 0)
{
System.out.println("There is no errors in " + key) ;
}
else
{
System.out.println("ERROR: there are unexpected errors in " + key);
}
}
You need to use Java generics.
Declare
htas aLinkedHashMap<Integer, Foo>whereFoois whatever data type you expect to be returned byht.get(). Using theMapinterface would be even better: