Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterator Pattern

 
simorgh hossein
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain Iterator Pattern in JAVA by a simple example,Thanks in advance
[ November 11, 2008: Message edited by: simorgh hossein ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iterator pattern is extensively used by all java Collection classes.
Nothing like going through the code and understanding yourself
 
Sergey Arnaut
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java implementationof iterator pattern allows user to traverse carious types of data sets without worrying about the underlying implementation of collection. Since clients simply interact with the iterator for themselves. Some will allow full access to the underlying data sets while others may restrict certain functionalities, such as removing items.

---- "Design patterns" by Jason McDonald

For example, just open src.zip in your JAVA_HOME or whait a few ours till I found my old examples
 
Sergey Arnaut
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is example:



Any questions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic