Class ImmutablePartCollection

  • All Implemented Interfaces:
    java.lang.Iterable<ImmutablePart>, java.util.Collection<ImmutablePart>, java.util.List<ImmutablePart>

    public final class ImmutablePartCollection
    extends java.util.AbstractList<ImmutablePart>
    Represents an immutable collection of ImmutableParts that compose a Multipart geometry (Polygon or Polyline). Use the ImmutablePartCollection returned from Multipart.getParts() to iterate through all of the parts in a Multipart.

    Because geometries themselves are immutable, the collections they are composed of are also immutable. For geometry editing or creation workflows, a mutable PartCollection is used instead. PartCollection has constructors that take an ImmutablePartCollection, allowing creation of new geometries from parts of existing ones.

    Since:
    100.0.0
    See Also:
    Polyline, Polygon, Multipart.getParts(), PartCollection, Part
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ImmutablePart get​(int index)
      Gets the ImmutablePart at the given index position in this ImmutablePartCollection.
      java.lang.Iterable<Point> getPartsAsPoints()
      Returns a copy of an iterable containing all the Points in all of the parts of this ImmutablePartCollection, ordered continuously from the first to last part in this collection.
      SpatialReference getSpatialReference()
      Gets the SpatialReference of geometries in the parts in this collection.
      int indexOf​(java.lang.Object o)  
      boolean isEmpty()  
      int size()
      Returns the number of ImmutableParts in this ImmutablePartCollection.
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Method Detail

      • getSpatialReference

        public SpatialReference getSpatialReference()
        Gets the SpatialReference of geometries in the parts in this collection. The SpatialReference defines how the coordinates of the geometries correspond to locations in the real world. May be null.
        Returns:
        the SpatialReference of the geometries in the parts in this collection
        Since:
        100.0.0
      • get

        public ImmutablePart get​(int index)
        Gets the ImmutablePart at the given index position in this ImmutablePartCollection. Use this to access the individual immutable parts that compose a Multipart geometry.
        Specified by:
        get in interface java.util.List<ImmutablePart>
        Specified by:
        get in class java.util.AbstractList<ImmutablePart>
        Parameters:
        index - the index of the ImmutablePart to return
        Returns:
        the ImmutablePart at the given index
        Throws:
        java.lang.IndexOutOfBoundsException - if index &lt; 0 || index &gt;= size()
        Since:
        100.0.0
      • getPartsAsPoints

        public java.lang.Iterable<Point> getPartsAsPoints()
        Returns a copy of an iterable containing all the Points in all of the parts of this ImmutablePartCollection, ordered continuously from the first to last part in this collection. If the ImmutablePartCollection isEmpty(), this method returns an empty iterable.

        The points represent the ends of the Segments in all of the ImmutableParts in this collection (all the vertices in the Multipart geometry. Where two adjacent segments share a start and end location (there is no gap between the segments), this is represented by a single Point.

        Alternatively, to iterate the Points in each part separately, call get or java.util.AbstractList.iterator() to get an ImmutablePart, then call ImmutablePart.getPoint(int) or ImmutablePart.getPoints().

        Returns:
        an iterable set of all the Points in all the parts of this ImmutablePartCollection
        Since:
        100.0.0
      • size

        public int size()
        Returns the number of ImmutableParts in this ImmutablePartCollection. Use this to find the maximum index for calling get(int).
        Specified by:
        size in interface java.util.Collection<ImmutablePart>
        Specified by:
        size in interface java.util.List<ImmutablePart>
        Specified by:
        size in class java.util.AbstractCollection<ImmutablePart>
        Since:
        100.0.0
        See Also:
        get(int)
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<ImmutablePart>
        Overrides:
        indexOf in class java.util.AbstractList<ImmutablePart>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<ImmutablePart>
        Specified by:
        isEmpty in interface java.util.List<ImmutablePart>
        Overrides:
        isEmpty in class java.util.AbstractCollection<ImmutablePart>