25 lines
383 B
D
25 lines
383 B
D
module dinermenuiterator;
|
|
|
|
import iterator, menuitem;
|
|
|
|
class DinerMenuIterator : Iterator
|
|
{
|
|
private MenuItem[] items;
|
|
private int position;
|
|
|
|
this(MenuItem[] items)
|
|
{
|
|
this.items = items;
|
|
}
|
|
|
|
override MenuItem next()
|
|
{
|
|
return items[position++];
|
|
}
|
|
|
|
override bool hasNext()
|
|
{
|
|
return items.length > position;
|
|
}
|
|
}
|