Added comments for iterator example.
This commit is contained in:
parent
4fef18f6c6
commit
40e5444718
@ -1,5 +1,12 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Iterator (ItemIterator) adds abstraction layer on top of a
|
||||
* collection (TreasureChest). This way the collection can change
|
||||
* its internal implementation without affecting its clients.
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Iterator interface.
|
||||
*
|
||||
*/
|
||||
public interface ItemIterator {
|
||||
|
||||
boolean hasNext();
|
||||
|
@ -3,6 +3,11 @@ package com.iluwatar;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Collection class.
|
||||
*
|
||||
*/
|
||||
public class TreasureChest {
|
||||
|
||||
private List<Item> items;
|
||||
|
Loading…
x
Reference in New Issue
Block a user