Class OverlayCollection

Object
OverlayCollection
All Implemented Interfaces:
Iterable<Overlay>

public class OverlayCollection extends Object implements Iterable<Overlay>
A collection of Overlay objects.

It is built on top of an internal list representation.

Author:
Owen Feehan
  • Constructor Details

    • OverlayCollection

      public OverlayCollection()
      Creates an empty collection.
    • OverlayCollection

      public OverlayCollection(Stream<Overlay> stream)
      Creates the collection from a stream of Overlays.

      Each element is reused internally, without any copying.

      Parameters:
      stream - the stream.
  • Method Details

    • iterator

      public Iterator<Overlay> iterator()
      Specified by:
      iterator in interface Iterable<Overlay>
    • get

      public Overlay get(int index)
      Access a particular element in the collection by index.
      Parameters:
      index - the index (starting at 0).
      Returns:
      the respective element at index index.
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index &lt; 0 || index &gt;= size())
    • size

      public int size()
      The total number of elements in the list.
      Returns:
      the total number of elements.
    • add

      public void add(Overlay overlay)
      Append an overlay to the end of the list.
      Parameters:
      overlay - the overlay to append.