Class TdbMessageProvidingList<E>

All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
TdbControlObjectList

public class TdbMessageProvidingList<E> extends TdbMessageProvider implements List<E>
  • Constructor Details

    • TdbMessageProvidingList

      public TdbMessageProvidingList(TdbSession session, TdbInterfaceType type) throws TdbException
      Constructor, should only be used by a derived class
      Parameters:
      session - Active session
      type - Type of connection for which this list is valid
      Throws:
      TdbException
    • TdbMessageProvidingList

      public TdbMessageProvidingList(TdbMessageProvidingList<E> r) throws TdbException
      Copy constructor, used to derive a list from an existing list
      Parameters:
      r - Existing list from which to copy
      Throws:
      TdbException
  • Method Details

    • add

      public boolean add(E o)
      Add a new element to the list
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface List<E>
      Parameters:
      o - New element to add
      Returns:
      true as required by the Collections framework contract
    • add

      public void add(int index, E o)
      Add a new element to the list at the provided position
      Specified by:
      add in interface List<E>
      Parameters:
      index - Offset at which to insert new element
      o - New element to insert
    • addAll

      public boolean addAll(Collection<? extends E> c)
      Add the contents of the provided collection to the current list
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface List<E>
      Parameters:
      c - Collection to add
      Returns:
      true as required by the Collections framework contract
    • addAll

      public boolean addAll(int index, Collection<? extends E> c)
      Insert the contents of the provided collection at the provided offset into the current list
      Specified by:
      addAll in interface List<E>
      Parameters:
      index - Offset at which to start inserting
      c - Collection to copy
      Returns:
      true as required by the Collections framework contract
    • clear

      public void clear()
      Remove all content from the current list
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface List<E>
    • contains

      public boolean contains(Object o)
      Check if the list contains a specific element
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface List<E>
      Parameters:
      o - Element to test for containment within the list
      Returns:
      true/false depending on whether the object is contained within the list
    • containsAll

      public boolean containsAll(Collection<?> c)
      Check if all elements in the provided collection are contained within the current list
      Specified by:
      containsAll in interface Collection<E>
      Specified by:
      containsAll in interface List<E>
      Parameters:
      c - Collection of elements to test for containment
      Returns:
      true/false depending on whether the objects in the collection are all contained within the list
    • get

      public E get(int index)
      Retrieve the strongly-typed element at the provided offset
      Specified by:
      get in interface List<E>
      Parameters:
      index - Offset from which to retrieve the element
      Returns:
      The element at the provided offset
    • indexOf

      public int indexOf(Object o)
      Retrieve the offset within the list at which the provided object exists, if any
      Specified by:
      indexOf in interface List<E>
      Parameters:
      o - The object for which to retrieve the offset
      Returns:
      The index of the provided element
    • isEmpty

      public boolean isEmpty()
      Test the list for emptiness
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface List<E>
      Returns:
      true / false
    • iterator

      public Iterator<E> iterator()
      Retrieve an iterator over the list, suitable for use in the for-each coding pattern
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface List<E>
      Returns:
      The iterator
    • lastIndexOf

      public int lastIndexOf(Object o)
      Retrieve the offset of the most highly-ordered element that matches the provided object
      Specified by:
      lastIndexOf in interface List<E>
      Parameters:
      o - Object for which to search
      Returns:
      right-most offset
    • listIterator

      public ListIterator<E> listIterator()
      Retrieve an iterator over the list
      Specified by:
      listIterator in interface List<E>
      Returns:
      The list iterator
    • listIterator

      public ListIterator<E> listIterator(int index)
      Retrieve an iterator over the list
      Specified by:
      listIterator in interface List<E>
      Returns:
      The list iterator
    • remove

      public boolean remove(Object o)
      Remove the provided object from the list, if found
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface List<E>
      Parameters:
      o - Object to remove
      Returns:
      true/false depending on whether the list contained the provided object
    • remove

      public E remove(int index)
      Remove and return the item at the provided offset
      Specified by:
      remove in interface List<E>
      Parameters:
      index - The index from which to remove the item
      Returns:
      The item that was removed
    • removeAll

      public boolean removeAll(Collection<?> c)
      Remove all items from the list that match objects in the provided collection
      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface List<E>
      Parameters:
      c - The collection of objects to remove from the list
      Returns:
      true if at least one item was removed
    • retainAll

      public boolean retainAll(Collection<?> c)
      Removes all items from the list that are not contained within the provided collection
      Specified by:
      retainAll in interface Collection<E>
      Specified by:
      retainAll in interface List<E>
      Parameters:
      c - The collection items to retain the list
      Returns:
      true if at least one item was removed from the list
    • set

      public E set(int index, E element)
      Modify the list to set the item at the provided offset to the provided content
      Specified by:
      set in interface List<E>
      Parameters:
      index - The offset of the item to modify
      element - The new content for the provided offset
      Returns:
      The old content at the provided offset
    • size

      public int size()
      Retrieve the number of objects contained within the list
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Returns:
      The number of objects in the list
    • subList

      public List<E> subList(int fromIndex, int toIndex)
      Retrieve a new list object that contains elements within a range of the current list
      Specified by:
      subList in interface List<E>
      Parameters:
      fromIndex - the offset at which the operation is to begin
      toIndex - the offset at which the operation is to stop
      Returns:
      a new list containing items from the old list, between the range of offsets provided
    • toArray

      public Object[] toArray()
      Retrieve an array containing elements from the list, in proper sequence
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
      Returns:
      An array containing objects from the list
    • toArray

      public <T> T[] toArray(T[] a)
      Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array.
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
      Parameters:
      a - the array into which elements of this list are to be stored; if this array is not big enough, another array will be allocated of the same runtime type.
      Returns:
      the array into which elements were stored; might be different from the provided array if the provided array was too small, but the runtime types will match.