edu.neu.ccs.quick
Class QuickVector

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byedu.neu.ccs.quick.QuickVector
All Implemented Interfaces:
Cloneable, Collection, List, RandomAccess, Serializable

public class QuickVector
extends Vector

QuickVector extends Vector by adding one constructor and three methods addItems, setItems, and removeItems that handle an array of Object at once.

All constructors of the original Vector class are provided as well.

No changes are made to the internal data structure or to any inherited methods.

Since:
2.3
Version:
2.3
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
QuickVector()
          A constructor that delegates to class Vector.
QuickVector(Collection c)
          A constructor that delegates to class Vector.
QuickVector(int initialCapacity)
          A constructor that delegates to class Vector.
QuickVector(int initialCapacity, int capacityIncrement)
          A constructor that delegates to class Vector.
QuickVector(Object[] items)
          Constructor that adds the given array of items one-by-one to the vector.
 
Method Summary
 void addItems(Object[] items)
          Method that adds the given array of items one-by-one to the vector.
 void removeItems(Object[] items)
          Method that removes the given array of items one-by-one from the vector.
 void setItems(Object[] items)
          Method that first clears this vector of any existing items and then adds the given array of items one-by-one to the vector.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

QuickVector

public QuickVector()
A constructor that delegates to class Vector.


QuickVector

public QuickVector(Collection c)
A constructor that delegates to class Vector.


QuickVector

public QuickVector(int initialCapacity)
A constructor that delegates to class Vector.


QuickVector

public QuickVector(int initialCapacity,
                   int capacityIncrement)
A constructor that delegates to class Vector.


QuickVector

public QuickVector(Object[] items)

Constructor that adds the given array of items one-by-one to the vector.

The capacity is set to the length of items.

If items is null, then the capacity is set to 10 (Java default) and nothing is added.

Parameters:
items - the array of items to add to this vector
See Also:
addItems(Object[])
Method Detail

addItems

public void addItems(Object[] items)

Method that adds the given array of items one-by-one to the vector.

If items is null, then does nothing.

Parameters:
items - the array of items to add to this vector
See Also:
QuickVector(Object[]), setItems(Object[]), removeItems(Object[])

setItems

public void setItems(Object[] items)

Method that first clears this vector of any existing items and then adds the given array of items one-by-one to the vector.

If items is null, then this method is equivalent to the inherited method clear.

Parameters:
items - the array of items to add to this vector after clearance
See Also:
addItems(Object[]), removeItems(Object[])

removeItems

public void removeItems(Object[] items)

Method that removes the given array of items one-by-one from the vector.

If items is null, then does nothing.

Parameters:
items - the array of items to remove from this vector
See Also:
addItems(Object[]), setItems(Object[])