Class OverlayCollection
Object
org.anchoranalysis.overlay.collection.OverlayCollection
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 Summary
Constructors Constructor Description OverlayCollection()Creates an empty collection.OverlayCollection(Stream<Overlay> stream)Creates the collection from a stream ofOverlays. -
Method Summary
-
Constructor Details
-
OverlayCollection
public OverlayCollection()Creates an empty collection. -
OverlayCollection
Creates the collection from a stream ofOverlays.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.
-