3 Years
Discussion Span
Last Post by JamesCherrill

Which part is the problem? Is there really nothing in the {}?
How is the class Song declared?

Edited by JamesCherrill


The statement, incomplete though it is declares a class SongIterator which expects two more classes, T and L. The class implements Iterator which is an Interface from the Collections API. java.util.Iterator operates on a collection of Songs(another class) which also expect classes T and L. The class definition is empty.

If you put this into your eclipse IDE and have the proper library jars available it will show you that there are unimplmented methods etc....

when I did this and createda dumy class of Song it requires methods hasNext() which returns a boolean, next() which returns a Song<T, L> and remove() which returns void.

Votes + Comments
Most useful explanation. Thanks

The missing methods are because the class is declared to implement an Iterator, but has an empty body that (obviously) doesn't implement the methods declared in the Iterator interface ( http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html ).

ps Speaking technically, T and L are type variables, not necessarily classes. A type variable can be any non-primitive type you specify: any class type, any interface type, any array type, or even another type variable ( http://docs.oracle.com/javase/tutorial/java/generics/types.html )

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.