Class OverlayCollection
Object
OverlayCollection
A collection of
Overlay
objects.
It is built on top of an internal list representation.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty collection.OverlayCollection
(Stream<Overlay> stream) Creates the collection from a stream ofOverlay
s. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
OverlayCollection
public OverlayCollection()Creates an empty collection. -
OverlayCollection
Creates the collection from a stream ofOverlay
s.Each element is reused internally, without any copying.
- Parameters:
stream
- the stream.
-
-
Method Details
-
iterator
-
get
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 < 0 || index >= size()
)
-
size
public int size()The total number of elements in the list.- Returns:
- the total number of elements.
-
add
Append an overlay to the end of the list.- Parameters:
overlay
- the overlay to append.
-