#107 Iterator example JavaDoc

This commit is contained in:
Ilkka Seppala 2015-08-18 23:14:04 +03:00
parent 5831d3239d
commit 0d2e033df6
7 changed files with 212 additions and 188 deletions

View File

@ -2,13 +2,17 @@ package com.iluwatar.iterator;
/** /**
* *
* Iterator (ItemIterator) adds abstraction layer on top of a collection * Iterator ({@link ItemIterator}) adds abstraction layer on top of a collection
* (TreasureChest). This way the collection can change its internal * ({@link TreasureChest}). This way the collection can change its internal
* implementation without affecting its clients. * implementation without affecting its clients.
* *
*/ */
public class App { public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) { public static void main(String[] args) {
TreasureChest chest = new TreasureChest(); TreasureChest chest = new TreasureChest();

View File

@ -1,5 +1,10 @@
package com.iluwatar.iterator; package com.iluwatar.iterator;
/**
*
* Item
*
*/
public class Item { public class Item {
private ItemType type; private ItemType type;

View File

@ -2,7 +2,7 @@ package com.iluwatar.iterator;
/** /**
* *
* Iterator interface. * ItemIterator interface.
* *
*/ */
public interface ItemIterator { public interface ItemIterator {

View File

@ -1,5 +1,10 @@
package com.iluwatar.iterator; package com.iluwatar.iterator;
/**
*
* ItemType enumeration
*
*/
public enum ItemType { public enum ItemType {
ANY, WEAPON, RING, POTION ANY, WEAPON, RING, POTION

View File

@ -5,7 +5,7 @@ import java.util.List;
/** /**
* *
* Collection class. * TreasureChest, the collection class.
* *
*/ */
public class TreasureChest { public class TreasureChest {

View File

@ -2,6 +2,11 @@ package com.iluwatar.iterator;
import java.util.List; import java.util.List;
/**
*
* TreasureChestItemIterator
*
*/
public class TreasureChestItemIterator implements ItemIterator { public class TreasureChestItemIterator implements ItemIterator {
private TreasureChest chest; private TreasureChest chest;

View File

@ -4,6 +4,11 @@ import org.junit.Test;
import com.iluwatar.iterator.App; import com.iluwatar.iterator.App;
/**
*
* Application test
*
*/
public class AppTest { public class AppTest {
@Test @Test