Package com.google.common.geometry
Class S2ShapeIndex.ShardedList<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- com.google.common.geometry.S2ShapeIndex.ShardedList<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
,java.util.RandomAccess
- Enclosing class:
- S2ShapeIndex
private static final class S2ShapeIndex.ShardedList<T> extends java.util.AbstractList<T> implements java.util.RandomAccess, java.io.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 Summary
Fields Modifier and Type Field Description private java.lang.Object[][]
elements
private static long
serialVersionUID
private int
size
-
Constructor Summary
Constructors Constructor Description ShardedList(int maxItems)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T item)
T
get(int index)
T
set(int index, T value)
int
size()
-
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
elements
private java.lang.Object[][] elements
-
size
private int size
-
-