Class RecyclableArrayList

java.lang.Object
java.util.AbstractCollection<java.lang.Object>
java.util.AbstractList<java.lang.Object>
java.util.ArrayList<java.lang.Object>
io.netty.util.internal.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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
     
     
    private boolean
     
    private static final Recycler<RecyclableArrayList>
     
    private static final long
     

    Fields inherited from class java.util.AbstractList

    modCount
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
    private
     
  • Method Summary

    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)
     
    private static void
    checkNullElements(java.util.Collection<?> c)
     
    boolean
    Returns true if any elements where added or set.
    Create a new empty RecyclableArrayList instance
    newInstance(int minCapacity)
    Create a new empty RecyclableArrayList instance with the given capacity.
    boolean
    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
  • Field Details

  • Constructor Details

  • Method Details

    • newInstance

      public static RecyclableArrayList newInstance()
      Create a new empty RecyclableArrayList instance
    • newInstance

      public static RecyclableArrayList newInstance(int minCapacity)
      Create a new empty RecyclableArrayList instance with the given capacity.
    • 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>
    • checkNullElements

      private static void checkNullElements(java.util.Collection<?> c)
    • 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.