Class KFList2<T>

  • All Implemented Interfaces:
    ej.kf.FeatureStateListener, java.lang.Iterable<T>, java.util.Collection<T>

    public class KFList2<T>
    extends AbstractKFList<T>
    Implementation of a AbstractKFList optimized for heap size. All internal arrays are resized, and iterators are executed without extra object copy.
    See Also:
    KFList
    • Constructor Summary

      Constructors 
      Constructor Description
      KFList2()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(T element)  
      boolean addAll​(java.util.Collection<? extends T> c)  
      void clear()  
      boolean contains​(java.lang.Object element)  
      boolean isEmpty()  
      java.util.Iterator<T> iterator()  
      boolean remove​(java.lang.Object element)  
      protected void removeAllElementsOwnedBy​(ej.kf.Feature feature)
      Removed all elements owned by the given Feature.
      int size()  
      protected void toArray​(java.util.ArrayList<T> allList)
      Add all the elements of the collection to the given ArrayList.
      • Methods inherited from class java.lang.Object

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

        equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • KFList2

        public KFList2()
    • Method Detail

      • contains

        public boolean contains​(java.lang.Object element)
      • add

        public boolean add​(T element)
        Throws:
        java.lang.IllegalArgumentException - if this method is called by the Kernel and the element is owned by a Feature.
      • remove

        public boolean remove​(java.lang.Object element)
      • iterator

        public java.util.Iterator<T> iterator()
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> c)
        Specified by:
        addAll in interface java.util.Collection<T>
        Overrides:
        addAll in class AbstractKFList<T>
      • clear

        public void clear()
      • isEmpty

        public boolean isEmpty()
      • size

        public int size()
      • toArray

        protected void toArray​(java.util.ArrayList<T> allList)
        Description copied from class: AbstractKFList
        Add all the elements of the collection to the given ArrayList.
        Specified by:
        toArray in class AbstractKFList<T>
        Parameters:
        allList - the list where all elements are added.
      • removeAllElementsOwnedBy

        protected void removeAllElementsOwnedBy​(ej.kf.Feature feature)
        Description copied from class: AbstractKFList
        Removed all elements owned by the given Feature.
        Specified by:
        removeAllElementsOwnedBy in class AbstractKFList<T>
        Parameters:
        feature - the owner of the elements to be removed