Class ResizeableArrayList<E>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

    public class ResizeableArrayList<E>
    extends java.util.AbstractList<E>
    implements java.util.List<E>, java.util.RandomAccess, java.lang.Cloneable, java.io.Serializable
    A List implementation, 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object clone()  
      <T> void copyFrom​(ResizeableArrayList<T> from)
      Copy elements from from into this instance
      E get​(int index)  
      void resize​(int minSize)
      Resize the underlying to at least minSize.
      E set​(int index, E value)  
      int size()  
      void sort​(java.util.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.lang.Iterable

        forEach
      • 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
    • Constructor Detail

      • ResizeableArrayList

        public ResizeableArrayList()
      • ResizeableArrayList

        public ResizeableArrayList​(int initialSize)
    • Method Detail

      • get

        public E get​(int index)
        Specified by:
        get in interface java.util.List<E>
        Specified by:
        get in class java.util.AbstractList<E>
      • resize

        public void resize​(int minSize)
        Resize the underlying to at least minSize.
        Parameters:
        minSize -
        Throws:
        java.lang.IllegalStateException - if the instance is not active.
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in interface java.util.List<E>
        Specified by:
        size in class java.util.AbstractCollection<E>
      • copyFrom

        public <T> void copyFrom​(ResizeableArrayList<T> from)
        Copy elements from from into this instance
      • set

        public E set​(int index,
                     E value)
        Specified by:
        set in interface java.util.List<E>
        Overrides:
        set in class java.util.AbstractList<E>
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • sort

        public void sort​(java.util.Comparator<? super E> comparator)
        Sort the elements, in-place, contained in this list using {@link Comparator#}
        Specified by:
        sort in interface java.util.List<E>
        Parameters:
        comparator - The Comparator to sort with