Sunday, October 28, 2007

Iterator for Collection and Nested Class

When we are creating an Iterator for a class, we are actually calling on the nested/inner class maybe. If the iterator is inside the main class, it makes perfect sense to put the iterator there with its hasNext(), hasElement(), initIterator(), and other methods... So we create an iterator like this and looks like a method call but it's a call on the nested class...

          Iterator iter = mySomeKindOfList.myListIterator ( );

No comments:

Just some daily notes ...

Powered By Blogger