Class TdbMessageProvidingList<E>

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

    public class TdbMessageProvidingList<E>
    extends TdbMessageProvider
    implements java.util.List<E>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, E o)
      Add a new element to the list at the provided position
      boolean add​(E o)
      Add a new element to the list
      boolean addAll​(int index, java.util.Collection<? extends E> c)
      Insert the contents of the provided collection at the provided offset into the current list
      boolean addAll​(java.util.Collection<? extends E> c)
      Add the contents of the provided collection to the current list
      void clear()
      Remove all content from the current list
      boolean contains​(java.lang.Object o)
      Check if the list contains a specific element
      boolean containsAll​(java.util.Collection<?> c)
      Check if all elements in the provided collection are contained within the current list
      E get​(int index)
      Retrieve the strongly-typed element at the provided offset
      int indexOf​(java.lang.Object o)
      Retrieve the offset within the list at which the provided object exists, if any
      boolean isEmpty()
      Test the list for emptiness
      java.util.Iterator<E> iterator()
      Retrieve an iterator over the list, suitable for use in the for-each coding pattern
      int lastIndexOf​(java.lang.Object o)
      Retrieve the offset of the most highly-ordered element that matches the provided object
      java.util.ListIterator<E> listIterator()
      Retrieve an iterator over the list
      java.util.ListIterator<E> listIterator​(int index)
      Retrieve an iterator over the list
      E remove​(int index)
      Remove and return the item at the provided offset
      boolean remove​(java.lang.Object o)
      Remove the provided object from the list, if found
      boolean removeAll​(java.util.Collection<?> c)
      Remove all items from the list that match objects in the provided collection
      boolean retainAll​(java.util.Collection<?> c)
      Removes all items from the list that are not contained within the provided collection
      E set​(int index, E element)
      Modify the list to set the item at the provided offset to the provided content
      int size()
      Retrieve the number of objects contained within the list
      java.util.List<E> subList​(int fromIndex, int toIndex)
      Retrieve a new list object that contains elements within a range of the current list
      java.lang.Object[] toArray()
      Retrieve an array containing elements from the list, in proper sequence
      <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.
      • Methods inherited from class java.lang.Object

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

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

        forEach
      • Methods inherited from interface java.util.List

        equals, hashCode, replaceAll, sort, spliterator
    • Constructor Detail

      • 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 Detail

      • add

        public boolean add​(E o)
        Add a new element to the list
        Specified by:
        add in interface java.util.Collection<E>
        Specified by:
        add in interface java.util.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 java.util.List<E>
        Parameters:
        index - Offset at which to insert new element
        o - New element to insert
      • addAll

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

        public boolean addAll​(int index,
                              java.util.Collection<? extends E> c)
        Insert the contents of the provided collection at the provided offset into the current list
        Specified by:
        addAll in interface java.util.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 java.util.Collection<E>
        Specified by:
        clear in interface java.util.List<E>
      • contains

        public boolean contains​(java.lang.Object o)
        Check if the list contains a specific element
        Specified by:
        contains in interface java.util.Collection<E>
        Specified by:
        contains in interface java.util.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​(java.util.Collection<?> c)
        Check if all elements in the provided collection are contained within the current list
        Specified by:
        containsAll in interface java.util.Collection<E>
        Specified by:
        containsAll in interface java.util.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 java.util.List<E>
        Parameters:
        index - Offset from which to retrieve the element
        Returns:
        The element at the provided offset
      • indexOf

        public int indexOf​(java.lang.Object o)
        Retrieve the offset within the list at which the provided object exists, if any
        Specified by:
        indexOf in interface java.util.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 java.util.Collection<E>
        Specified by:
        isEmpty in interface java.util.List<E>
        Returns:
        true / false
      • iterator

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

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

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

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

        public boolean remove​(java.lang.Object o)
        Remove the provided object from the list, if found
        Specified by:
        remove in interface java.util.Collection<E>
        Specified by:
        remove in interface java.util.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 java.util.List<E>
        Parameters:
        index - The index from which to remove the item
        Returns:
        The item that was removed
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Remove all items from the list that match objects in the provided collection
        Specified by:
        removeAll in interface java.util.Collection<E>
        Specified by:
        removeAll in interface java.util.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​(java.util.Collection<?> c)
        Removes all items from the list that are not contained within the provided collection
        Specified by:
        retainAll in interface java.util.Collection<E>
        Specified by:
        retainAll in interface java.util.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 java.util.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 java.util.Collection<E>
        Specified by:
        size in interface java.util.List<E>
        Returns:
        The number of objects in the list
      • subList

        public java.util.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 java.util.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 java.lang.Object[] toArray()
        Retrieve an array containing elements from the list, in proper sequence
        Specified by:
        toArray in interface java.util.Collection<E>
        Specified by:
        toArray in interface java.util.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 java.util.Collection<E>
        Specified by:
        toArray in interface java.util.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.