Added comments for iterator example.
This commit is contained in:
parent
4fef18f6c6
commit
40e5444718
@ -1,5 +1,12 @@
|
|||||||
package com.iluwatar;
|
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 class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Iterator interface.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ItemIterator {
|
public interface ItemIterator {
|
||||||
|
|
||||||
boolean hasNext();
|
boolean hasNext();
|
||||||
|
@ -3,6 +3,11 @@ package com.iluwatar;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Collection class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class TreasureChest {
|
public class TreasureChest {
|
||||||
|
|
||||||
private List<Item> items;
|
private List<Item> items;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user