Class RecyclableArrayList

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

    public final class RecyclableArrayList
    extends java.util.ArrayList<java.lang.Object>
    A simple list which is recyclable. This implementation does not allow null elements to be added.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Object element)  
      boolean add​(java.lang.Object element)  
      boolean addAll​(int index, java.util.Collection<?> c)  
      boolean addAll​(java.util.Collection<?> c)  
      boolean insertSinceRecycled()
      Returns true if any elements where added or set.
      static RecyclableArrayList newInstance()
      Create a new empty RecyclableArrayList instance
      static RecyclableArrayList newInstance​(int minCapacity)
      Create a new empty RecyclableArrayList instance with the given capacity.
      boolean recycle()
      Clear and recycle this instance.
      java.lang.Object set​(int index, java.lang.Object element)  
      • Methods inherited from class java.util.ArrayList

        clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractList

        equals, hashCode
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream
      • Methods inherited from interface java.util.List

        containsAll, equals, hashCode
    • Method Detail

      • addAll

        public boolean addAll​(java.util.Collection<?> c)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Object>
        Specified by:
        addAll in interface java.util.List<java.lang.Object>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.Object>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<?> c)
        Specified by:
        addAll in interface java.util.List<java.lang.Object>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.Object>
      • add

        public boolean add​(java.lang.Object element)
        Specified by:
        add in interface java.util.Collection<java.lang.Object>
        Specified by:
        add in interface java.util.List<java.lang.Object>
        Overrides:
        add in class java.util.ArrayList<java.lang.Object>
      • add

        public void add​(int index,
                        java.lang.Object element)
        Specified by:
        add in interface java.util.List<java.lang.Object>
        Overrides:
        add in class java.util.ArrayList<java.lang.Object>
      • set

        public java.lang.Object set​(int index,
                                    java.lang.Object element)
        Specified by:
        set in interface java.util.List<java.lang.Object>
        Overrides:
        set in class java.util.ArrayList<java.lang.Object>
      • insertSinceRecycled

        public boolean insertSinceRecycled()
        Returns true if any elements where added or set. This will be reset once recycle() was called.
      • recycle

        public boolean recycle()
        Clear and recycle this instance.