|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractList java.util.Vector com.isti.util.VectorSet
Class VectorSet extends the "Vector" class to support the "Set" interface.
Field Summary |
Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
VectorSet()
Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero. |
|
VectorSet(java.util.Collection c)
Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
VectorSet(int initialCapacity)
Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero. |
|
VectorSet(int initialCapacity,
int capacityIncrement)
Constructs an empty vector with the specified initial capacity and capacity increment. |
|
VectorSet(java.util.Set s)
Constructs a vector containing the elements of the specified set, in the order they are returned by the set's iterator. |
Method Summary | |
void |
add(int index,
java.lang.Object element)
Inserts the specified element at the specified position in this Vector if it is not already present. |
boolean |
add(java.lang.Object o)
Appends the specified element to the end of this Vector if it is not already present. |
boolean |
addAll(java.util.Collection c)
Adds all of the elements in the specified collection to this set if they're not already present. |
boolean |
addAll(int index,
java.util.Collection c)
Inserts all of the elements in in the specified Collection into this Vector at the specified position if they're not already present. |
void |
addElement(java.lang.Object obj)
Adds the specified component to the end of this vector if it is not already present. |
void |
insertElementAt(java.lang.Object obj,
int index)
Inserts the specified object as a component in this vector at the specified index if it is not already present. |
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this Vector with the specified element if it is not already present. |
void |
setElementAt(java.lang.Object obj,
int index)
Sets the component at the specified index of this
vector to be the specified object if it is not already present. |
Methods inherited from class java.util.Vector |
capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, 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.Set |
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
Constructor Detail |
public VectorSet()
public VectorSet(java.util.Collection c)
c
- the collection whose elements are to be placed into this
vector.public VectorSet(int initialCapacity)
initialCapacity
- the initial capacity of the vector.
java.lang.IllegalArgumentException
- if the specified initial capacity
is negativepublic VectorSet(int initialCapacity, int capacityIncrement)
initialCapacity
- the initial capacity of the vector.capacityIncrement
- the amount by which the capacity is
increased when the vector overflows.
java.lang.IllegalArgumentException
- if the specified initial capacity
is negativepublic VectorSet(java.util.Set s)
s
- the set whose elements are to be placed into this
vector.Method Detail |
public void add(int index, java.lang.Object element)
add
in interface java.util.List
index
- index at which the specified element is to be inserted.element
- element to be inserted.
java.lang.ArrayIndexOutOfBoundsException
- index is out of range
(index < 0 || index > size()).public boolean add(java.lang.Object o)
o
, to this set if this set contains no element
e
such that (o==null ? e==null :
o.equals(e))
. If this set already contains the specified
element, the call leaves this set unchanged and returns false.
In combination with the restriction on constructors, this ensures that
sets never contain duplicate elements.
add
in interface java.util.Set
o
- element to be added to this set.
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Set
c
- collection whose elements are to be added to this set.
add(Object)
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
index
- index at which to insert first element
from the specified collection.c
- elements to be inserted into this Vector.
java.lang.ArrayIndexOutOfBoundsException
- index out of range (index
< 0 || index > size()).public void addElement(java.lang.Object obj)
obj
- the component to be added.add(Object)
,
List
public void insertElementAt(java.lang.Object obj, int index)
index
if it is not already present. Each
component in this vector with an index greater or equal to the
specified index
is shifted upward to have an index
one greater than the value it had previously.
The index must be a value greater than or equal to 0
and less than or equal to the current size of the vector. (If the
index is equal to the current size of the vector, the new element
is appended to the Vector.)
This method is identical in functionality to the add(Object, int) method (which is part of the List interface). Note that the add method reverses the order of the parameters, to more closely match array usage.
obj
- the component to insert.index
- where to insert the new component.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.Vector.size()
,
add(int, Object)
,
List
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
index
- index of element to replace.element
- element to be stored at the specified position.
java.lang.ArrayIndexOutOfBoundsException
- index out of range
(index < 0 || index >= size()).
java.lang.IllegalArgumentException
- fromIndex > toIndex.public void setElementAt(java.lang.Object obj, int index)
index
of this
vector to be the specified object if it is not already present.
The previous component at that position is discarded.
The index must be a value greater than or equal to 0
and less than the current size of the vector.
This method is identical in functionality to the set method (which is part of the List interface). Note that the set method reverses the order of the parameters, to more closely match array usage. Note also that the set method returns the old value that was stored at the specified position.
obj
- what the component is to be set to.index
- the specified index.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.Vector.size()
,
List
,
set(int, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |