Beware of a hasNext() method which always returns true, and a next() method which creates a new Object() each call. Just imagine how that will behave in a while loop
What you have is an anonymous class; we discuss them every now and again, and you can find the older threads by searching for "anonymous class" with the link above. You can take a class (abstract or concrete) or an interface and implement/override a method and then write new Foo(). They are most commonly used for Runnables and for Listeners in Swing. You can override any method, but you can't write a constructor. So you have to use the same constructor as the original class/interface; if there is no written constructor then you get a default constructor.
There will be lots more information in the old threads; please search the forum.