cetus.hir
Class ChainedList<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<T>
                  extended by cetus.hir.ChainedList<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.Deque<T>, java.util.List<T>, java.util.Queue<T>

public class ChainedList<T>
extends java.util.LinkedList<T>

Very similar to a LinkedList, except provides an add method that returns the list itself, allowing you to perform method chaining. A beneficial side effect is that you can add multiple elements directly to a list created with the new operator, without first creating a new variable to hold a reference to the list object. ChainedLists can be used anywhere a LinkedList or List occurs, and are entirely optional. It is possible to write passes for Cetus without using this class, however you will find that your code contains a lot of temporary lists created for the sole purpose of passing them as method arguments.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ChainedList()
          Constructs an empty list.
ChainedList(java.util.Collection<T> c)
          Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
 
Method Summary
 ChainedList addAllLinks(java.util.Collection<T> c)
          Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.
 ChainedList addLink(T o)
          Appends the specified element to the end of this list.
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

ChainedList

public ChainedList()
Constructs an empty list.


ChainedList

public ChainedList(java.util.Collection<T> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Parameters:
c - The collection whose elements are to be placed into this list.
Method Detail

addAllLinks

public ChainedList addAllLinks(java.util.Collection<T> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.

Parameters:
c - The collection whose elements are to be placed into this list.
Returns:
this list.

addLink

public ChainedList addLink(T o)
Appends the specified element to the end of this list.

Parameters:
o - Element to be appended to this list.
Returns:
this list.