File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
iterator/src/main/java/com/iluwatar Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Iterator (ItemIterator) adds abstraction layer on top of a
6+ * collection (TreasureChest). This way the collection can change
7+ * its internal implementation without affecting its clients.
8+ *
9+ */
310public class App
411{
512 public static void main ( String [] args )
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Iterator interface.
6+ *
7+ */
38public interface ItemIterator {
49
510 boolean hasNext ();
Original file line number Diff line number Diff line change 33import java .util .ArrayList ;
44import java .util .List ;
55
6+ /**
7+ *
8+ * Collection class.
9+ *
10+ */
611public class TreasureChest {
712
813 private List <Item > items ;
You can’t perform that action at this time.
0 commit comments