I have the following code using generics:
Set membersKeySet = membersList.keySet();
Iterator<DoubleKey> membersItr = membersKeySet.iterator();
while(membersItr.hasNext()){
DoubleKey<Integer, Integer> dk = membersItr.next();
}
Eclipse tells me that “Set is a raw type. References to generic type <E> should be parametrized”. DoubleKey is also a Generic class. What I understand is that the .iterator() method doesn’t assure that the DoubleKey Class has been passed with the same parameter types. I tried typecasting but it doesn’t work. How can I pull this off? Thanks!
P.S. I’m still n00b inusing Generics.
If the objects stored in the set are instances of
DoubleKey<Integer, Integer>, then the code should look like this :