Class S2ShapeIndex.ShardedList<T>

java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
com.google.common.geometry.S2ShapeIndex.ShardedList<T>
All Implemented Interfaces:
Serializable, Iterable<T>, Collection<T>, List<T>, RandomAccess, SequencedCollection<T>
Enclosing class:
S2ShapeIndex

private static final class S2ShapeIndex.ShardedList<T> extends AbstractList<T> implements RandomAccess, Serializable
A more complex append-only RandomAccess List that allocates space in shards of 256 elements each, avoiding reallocation as the list grows, and avoiding single allocations larger than 2KB. This is about 1% faster than SimpleList with reserveEdges in use, but when the heap is anywhere near full, this approach is dramatically faster than any technique requiring a large contiguous allocation, since it will probably require a GC to supply one.
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • elements

      private Object[][] elements
    • size

      private int size
  • Constructor Details

    • ShardedList

      public ShardedList(int maxItems)
  • Method Details