Iterators
- Use standard Iterator interface type
public interface Iterator<LineItem>
{
boolean hasNext();
LineItem next();
void remove();
}
- remove is "optional operation" (see ch. 8)
- implement to throw UnsupportedException
- implement hasNext/next manually to show inner workings
- Ch5/invoice/Invoice.java