Class CacheHoldingArrayList<E>

  • Type Parameters:
    E - The element type
    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 CacheHoldingArrayList<E>
    extends java.util.ArrayList<E>
    This is an extension of the the ArrayList class, designed to be used by systems that return Lists of data, with extra data that should not be flushed out of a cache until the List is garbage collected. This is used for example in the ObjectStoreItemPathFollowingImpl, when it generates a batch. The objectstore fetches additional useful objects, and stores them in the holder of a CacheHoldingArrayList as well as a cache. The holder them prevents the extra useful objects from being flushed out of the cache until the DataTranslator has finished with the batch.
    Author:
    Matthew Wakeling
    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
      void addToHolder​(java.lang.Object o)
      Adds an object to the holder.
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • 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, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • CacheHoldingArrayList

        public CacheHoldingArrayList()
        Empty constructor
      • CacheHoldingArrayList

        public CacheHoldingArrayList​(java.util.Collection<E> col)
        Constructs a new instance from another Collection.
        Parameters:
        col - a Collection
      • CacheHoldingArrayList

        public CacheHoldingArrayList​(int capacity)
        Constructs a new instance with the given initial capacity.
        Parameters:
        capacity - the initial capacity
    • Method Detail

      • addToHolder

        public void addToHolder​(java.lang.Object o)
        Adds an object to the holder. This prevents the given object from being garbage collected until this List is garbage-collected.
        Parameters:
        o - any Object