Class ConcreteAggregate<T>

java.lang.Object
Behavioral.Iterator.ConcreteAggregate<T>
Type Parameters:
T - The type of elements in the collection.
All Implemented Interfaces:
Aggregate<T>

public class ConcreteAggregate<T> extends Object implements Aggregate<T>
Concrete Aggregate that holds a collection of items. Implements the Aggregate interface and provides a method to create iterators.
  • Constructor Details

    • ConcreteAggregate

      public ConcreteAggregate()
      Constructor initializes an empty collection.
  • Method Details

    • addItem

      public void addItem(T item)
      Add an item to the collection.
      Parameters:
      item - The item to add.
    • createIterator

      public Iterator<T> createIterator()
      Description copied from interface: Aggregate
      Create an iterator for the collection.
      Specified by:
      createIterator in interface Aggregate<T>
      Returns:
      An iterator for the collection.