Class FreezableArrayList<ITEM>

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

    public class FreezableArrayList<ITEM>
    extends ListenableArrayList<ITEM>
    An array list which can be frozen to disallow further edits. After freezing, edit operations will throw UnsupportedOperationException. Freezable lists may optionally allow new items to be added to the end of the list also after freeze.
    Since:
    5.20
    Author:
    bratseth
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      FreezableArrayList()
      Creates a freezable array list which does not permit adds after freeze
      FreezableArrayList​(boolean permitAddAfterFreeze)  
      FreezableArrayList​(boolean permitAddAfterFreeze, int initialCapacity)  
      FreezableArrayList​(int initialCapacity)
      Creates a freezable array list which does not permit adds after freeze
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, ITEM e)  
      boolean add​(ITEM e)  
      boolean addAll​(int index, java.util.Collection<? extends ITEM> a)  
      boolean addAll​(java.util.Collection<? extends ITEM> a)  
      void clear()  
      void freeze()
      Irreversibly freezes the content of this
      ITEM remove​(int index)  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      protected void removeRange​(int fromIndex, int toIndex)  
      boolean retainAll​(java.util.Collection<?> c)  
      ITEM set​(int index, ITEM e)  
      • Methods inherited from class java.util.ArrayList

        clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, 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

      • FreezableArrayList

        public FreezableArrayList()
        Creates a freezable array list which does not permit adds after freeze
      • FreezableArrayList

        public FreezableArrayList​(int initialCapacity)
        Creates a freezable array list which does not permit adds after freeze
      • FreezableArrayList

        public FreezableArrayList​(boolean permitAddAfterFreeze)
      • FreezableArrayList

        public FreezableArrayList​(boolean permitAddAfterFreeze,
                                  int initialCapacity)
    • Method Detail

      • freeze

        public void freeze()
        Irreversibly freezes the content of this
      • add

        public boolean add​(ITEM e)
        Specified by:
        add in interface java.util.Collection<ITEM>
        Specified by:
        add in interface java.util.List<ITEM>
        Overrides:
        add in class ListenableArrayList<ITEM>
      • addAll

        public boolean addAll​(java.util.Collection<? extends ITEM> a)
        Specified by:
        addAll in interface java.util.Collection<ITEM>
        Specified by:
        addAll in interface java.util.List<ITEM>
        Overrides:
        addAll in class ListenableArrayList<ITEM>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends ITEM> a)
        Specified by:
        addAll in interface java.util.List<ITEM>
        Overrides:
        addAll in class ListenableArrayList<ITEM>
      • remove

        public ITEM remove​(int index)
        Specified by:
        remove in interface java.util.List<ITEM>
        Overrides:
        remove in class java.util.ArrayList<ITEM>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<ITEM>
        Specified by:
        remove in interface java.util.List<ITEM>
        Overrides:
        remove in class java.util.ArrayList<ITEM>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<ITEM>
        Specified by:
        clear in interface java.util.List<ITEM>
        Overrides:
        clear in class java.util.ArrayList<ITEM>
      • removeRange

        protected void removeRange​(int fromIndex,
                                   int toIndex)
        Overrides:
        removeRange in class java.util.ArrayList<ITEM>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<ITEM>
        Specified by:
        removeAll in interface java.util.List<ITEM>
        Overrides:
        removeAll in class java.util.ArrayList<ITEM>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<ITEM>
        Specified by:
        retainAll in interface java.util.List<ITEM>
        Overrides:
        retainAll in class java.util.ArrayList<ITEM>