Class KFList2<T>

    • Constructor Detail

      • KFList2

        public KFList2()
    • Method Detail

      • contains

        public boolean contains​(Object element)
        Description copied from interface: Collection
        Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
        Parameters:
        element - element whose presence in this collection is to be tested
        Returns:
        true if this collection contains the specified element
      • add

        public boolean add​(T element)
        Description copied from interface: Collection
        Ensures that this collection contains the specified element (optional operation). Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)

        Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.

        If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false ). This preserves the invariant that a collection always contains the specified element after this call returns.

        Parameters:
        element - element whose presence in this collection is to be ensured
        Returns:
        true if this collection changed as a result of the call
        Throws:
        IllegalArgumentException - if this method is called by the Kernel and the element is owned by a Feature.
      • remove

        public boolean remove​(Object element)
        Description copied from interface: Collection
        Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).
        Parameters:
        element - element to be removed from this collection, if present
        Returns:
        true if an element was removed as a result of this call
      • iterator

        public Iterator<T> iterator()
        Description copied from interface: Collection
        Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).
        Returns:
        an Iterator over the elements in this collection
      • addAll

        public boolean addAll​(Collection<? extends T> c)
        Description copied from interface: Collection
        Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)
        Specified by:
        addAll in interface Collection<T>
        Overrides:
        addAll in class AbstractKFList<T>
        Parameters:
        c - collection containing elements to be added to this collection
        Returns:
        true if this collection changed as a result of the call
        See Also:
        Collection.add(Object)
      • clear

        public void clear()
        Description copied from interface: Collection
        Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Collection
        Returns true if this collection contains no elements.
        Returns:
        true if this collection contains no elements
      • size

        public int size()
        Description copied from interface: Collection
        Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Returns:
        the number of elements in this collection
      • toArray

        protected void toArray​(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.