Package org.alfresco.solr
Class ResizeableArrayList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.alfresco.solr.ResizeableArrayList<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,RandomAccess
public class ResizeableArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable
AListimplementation, backed by an array, taht supports resizing. This class supports the reuse of arrays across cache instances, reducing the number of temporary objects created by the Alfresco Solr indexing service.- Author:
- Alex Miller
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description ResizeableArrayList()ResizeableArrayList(int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Objectclone()<T> voidcopyFrom(ResizeableArrayList<T> from)Copy elements from from into this instanceEget(int index)voidresize(int minSize)Resize the underlying to at least minSize.Eset(int index, E value)intsize()voidsort(Comparator<? super E> comparator)Sort the elements, in-place, contained in this list using {@link Comparator#}-
Methods inherited from class java.util.AbstractList
add, 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
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
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, spliterator, subList, toArray, toArray
-
-
-
-
Method Detail
-
get
public E get(int index)
-
resize
public void resize(int minSize)
Resize the underlying to at least minSize.- Parameters:
minSize-- Throws:
IllegalStateException- if the instance is not active.
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
copyFrom
public <T> void copyFrom(ResizeableArrayList<T> from)
Copy elements from from into this instance
-
clone
protected Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
sort
public void sort(Comparator<? super E> comparator)
Sort the elements, in-place, contained in this list using {@link Comparator#}- Specified by:
sortin interfaceList<E>- Parameters:
comparator- TheComparatorto sort with
-
-