Class NotableLinkedList<E>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
AbstractGroup.ChildArray, Document.ChildArray, Element.AttrArray

public class NotableLinkedList<E> extends AbstractSequentialList<E> implements List<E>, Cloneable, Serializable
Linked list implementation of the List interface that provides the callback methods such as onAdd(E, E), onSet(E, E) and onRemove(E).
Since:
5.0.8
Author:
tomyeh
See Also:
  • Constructor Details

    • NotableLinkedList

      public NotableLinkedList()
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Specified by:
      size in class AbstractCollection<E>
    • listIterator

      public ListIterator<E> listIterator(int index)
      Specified by:
      listIterator in interface List<E>
      Specified by:
      listIterator in class AbstractSequentialList<E>
    • onAdd

      protected void onAdd(E newElement, E followingElement)
      Called each time an new element is about being added into the array.

      Deriving classes usually put checking codes here. And, throws exception if failure and nothing will be affected.

      Parameters:
      newElement - the element to be added
      followingElement - the element that will 'follow' the new element. In other words, newElement will be inserted before followingElement. If null, it means newElement is appended at the end
    • onSet

      protected void onSet(E newElement, E replaced)
      Called each time an element is about being assigned into the array and replace an existence one (by ListIterator.set).

      Deriving classes usually put checking codes here. And, throws exception if failure and nothing will be affected.

      Parameters:
      newElement - the element to be added
      replaced - the element to be replaced
    • onRemove

      protected void onRemove(E element)
      Called each time an element is about being removed from the array. Deriving classes usually put checking codes here. And, throws exception if failure.