I'm trying to write an Iterator class for a LinkedList class that I wrote. One of the methods is "public E next()" I try to return an "E" but eclipse says "cannot convert from Object to E". How do I fix this?
Object is a class and E is a generic type parameter . And Iterator class alwayes return Object so to fix this problem, you need to call it. For example
What's the difference between Object and "E"?
One of the methods is "public E next()"
I try to return an "E" but eclipse says "cannot convert from Object to E".
How do I fix this?
Profile Answers by esekiel Questions by esekiel
Questions by esekiel