#107 Iterator example JavaDoc
This commit is contained in:
parent
5831d3239d
commit
0d2e033df6
@ -2,13 +2,17 @@ package com.iluwatar.iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* Iterator (ItemIterator) adds abstraction layer on top of a collection
|
||||
* (TreasureChest). This way the collection can change its internal
|
||||
* 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();
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* Item
|
||||
*
|
||||
*/
|
||||
public class Item {
|
||||
|
||||
private ItemType type;
|
||||
|
@ -2,7 +2,7 @@ package com.iluwatar.iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* Iterator interface.
|
||||
* ItemIterator interface.
|
||||
*
|
||||
*/
|
||||
public interface ItemIterator {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* ItemType enumeration
|
||||
*
|
||||
*/
|
||||
public enum ItemType {
|
||||
|
||||
ANY, WEAPON, RING, POTION
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Collection class.
|
||||
* TreasureChest, the collection class.
|
||||
*
|
||||
*/
|
||||
public class TreasureChest {
|
||||
|
@ -2,6 +2,11 @@ package com.iluwatar.iterator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* TreasureChestItemIterator
|
||||
*
|
||||
*/
|
||||
public class TreasureChestItemIterator implements ItemIterator {
|
||||
|
||||
private TreasureChest chest;
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar.iterator.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user