package com.iluwatar.iterator;

/**
 * 
 * Iterator ({@link ItemIterator}) adds abstraction layer on top of a collection
 * ({@link TreasureChest}). This way the collection can change its internal
 * implementation without affecting its clients.
 * 
 */
public class App {

	/**
	 * Program entry point
	 * @param args command line args
	 */
	public static void main(String[] args) {
		TreasureChest chest = new TreasureChest();

		ItemIterator ringIterator = chest.Iterator(ItemType.RING);
		while (ringIterator.hasNext()) {
			System.out.println(ringIterator.next());
		}

		System.out.println("----------");

		ItemIterator potionIterator = chest.Iterator(ItemType.POTION);
		while (potionIterator.hasNext()) {
			System.out.println(potionIterator.next());
		}

		System.out.println("----------");

		ItemIterator weaponIterator = chest.Iterator(ItemType.WEAPON);
		while (weaponIterator.hasNext()) {
			System.out.println(weaponIterator.next());
		}

		System.out.println("----------");

		ItemIterator it = chest.Iterator(ItemType.ANY);
		while (it.hasNext()) {
			System.out.println(it.next());
		}
	}
}

@@ -35,16 +35,244 @@
 *%0A * %0A *
+ The Iterator pattern is a design pattern in which an iterator is used to %0A * traverse a container and access the container's elements. The Iterator pattern %0A * decouples algorithms from containers.%0A * %3Cp%3E%0A * In this example the
  Iterato
@@ -322,16 +322,20 @@
 ayer on 
+%0A * 
 top of a
@@ -345,19 +345,16 @@
 llection
-%0A *
  (%7B@link
@@ -406,16 +406,20 @@
  change 
+%0A * 
 its inte
@@ -422,19 +422,16 @@
 internal
-%0A *
  impleme

Improve Iterator Javadoc