I ran into a problem I just couldn't figure out, so I was confident you hardcore's in here could help me out.
I am writing a generic subclass to the AbstractCollection class that is located in the java.util library. To do this, I need to override two methods - iterator() that will return an iterator<E> (E is the element of random type) - an the method size() - which is not the problem.
the method "public Iterator<E> iterator()" is the problem. I made it like this:
public Iterator<E> iterator() {
i = (Iterator<E>) map.keySet().iterator();
return i;
}

New Topic/Question
Reply



MultiQuote



|