Class FreezableList<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>
    Direct Known Subclasses:
    IdentifiableContainerBase, IORTemplateListImpl

    public class FreezableList<E>
    extends java.util.AbstractList<E>
    Simple class that delegates all List operations to another list. It also can be frozen, which means that a number of operations can be performed on the list, and then the list can be made immutable, so that no further changes are possible. A FreezableList is frozen using the makeImmutable method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<E> delegate  
      private boolean immutable  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      FreezableList​(java.util.List<E> delegate)  
      FreezableList​(java.util.List<E> delegate, boolean immutable)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, E element)  
      boolean equals​(java.lang.Object obj)  
      E get​(int index)  
      int hashCode()  
      boolean isImmutable()  
      void makeElementsImmutable()  
      void makeImmutable()  
      E remove​(int index)  
      E set​(int index, E element)  
      int size()  
      java.util.List<E> subList​(int fromIndex, int toIndex)  
      • Methods inherited from class java.util.AbstractList

        add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

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

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Field Detail

      • delegate

        private java.util.List<E> delegate
      • immutable

        private boolean immutable
    • Constructor Detail

      • FreezableList

        public FreezableList​(java.util.List<E> delegate,
                             boolean immutable)
      • FreezableList

        public FreezableList​(java.util.List<E> delegate)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Collection<E>
        Specified by:
        equals in interface java.util.List<E>
        Overrides:
        equals in class java.util.AbstractList<E>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<E>
        Specified by:
        hashCode in interface java.util.List<E>
        Overrides:
        hashCode in class java.util.AbstractList<E>
      • makeImmutable

        public void makeImmutable()
      • isImmutable

        public boolean isImmutable()
      • makeElementsImmutable

        public void makeElementsImmutable()
      • 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>
      • get

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

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

        public void add​(int index,
                        E element)
        Specified by:
        add in interface java.util.List<E>
        Overrides:
        add in class java.util.AbstractList<E>
      • remove

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

        public java.util.List<E> subList​(int fromIndex,
                                         int toIndex)
        Specified by:
        subList in interface java.util.List<E>
        Overrides:
        subList in class java.util.AbstractList<E>