Package com.google.common.geometry
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 Summary
FieldsFields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
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
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.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
elements
-
size
private int size
-
-
Constructor Details
-
ShardedList
public ShardedList(int maxItems)
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceList<T>
- Specified by:
size
in classAbstractCollection<T>
-
add
- Specified by:
add
in interfaceCollection<T>
- Specified by:
add
in interfaceList<T>
- Overrides:
add
in classAbstractList<T>
-
get
-
set
-