|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
ariba.util.core.Vector
public class Vector
Object subclass that manages an array of objects. A Vector cannot contain null.
Constructor Summary | |
---|---|
Vector()
Deprecated. use ListUtil.list |
|
Vector(java.util.Collection collection)
Deprecated. use ListUtil.list() |
|
Vector(int initialCapacity)
Deprecated. use ListUtil.list |
|
Vector(java.lang.Object[] array)
Deprecated. use ListUtil.list |
|
Vector(java.lang.Object[] array,
boolean copy)
Deprecated. use ListUtil.arrayToList |
|
Vector(Vector copy)
Deprecated. use ListUtil.list |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
Inserts the specified element at the specified position in this list. |
boolean |
add(java.lang.Object element)
Appends the specified element to the end of this List (optional operation). |
boolean |
addAll(java.util.Collection c)
Adds the elements contained in c to the end of the Vector. |
void |
addElement(java.lang.Object element)
Deprecated. use add () |
void |
addElementIfAbsent(java.lang.Object element)
Deprecated. use ListUtil.addElementIfAbsent. Since performance of this method is linear with the size of the list, consider using a different datastructure such as java.util.HashSet |
void |
addElements(Vector aVector)
Deprecated. use addAll instead |
void |
addElementsIfAbsent(Vector aVector)
Deprecated. use ListUtil.addElementsIfAbsent. Since performance of this method is linear with the size of the list, consider using a different datastructure such as java.util.HashSet |
int |
capacity()
Deprecated. code should not be concerned with such internal details |
void |
clear()
Removes all of the elements from this collection. |
java.lang.Object |
clone()
Clones the Vector. |
boolean |
contains(java.lang.Object element)
Searches for the specified element in the Vector. |
boolean |
containsIdentical(java.lang.Object element)
Deprecated. use ListUtil.containsIdentical instead |
void |
copyInto(java.lang.Object[] anArray)
Deprecated. use toArray(Object[]) |
void |
copyInto(java.lang.Object[] anArray,
int startingAt)
Deprecated. use ariba.util.core.ListUtil.copyInto() |
int |
count()
Deprecated. use size() |
java.lang.Object[] |
elementArray()
Deprecated. use toArray |
java.lang.Object[] |
elementArrayNoCopy()
Deprecated. this is not supported with java's collection classes and should not be used by Ariba code. Callers should take the performance hit of using the supported methods toArray clear and
addElements(ListUtil.arrayToList(Object[])) |
java.lang.Object |
elementAt(int index)
Deprecated. use get |
java.util.Enumeration |
elements()
Deprecated. use iterator () |
java.util.Enumeration |
elements(int index)
Deprecated. use listIterator(int) |
void |
ensureCapacity(int minCapacity)
Deprecated. callers do not need to be aware of internal storage details |
boolean |
equals(java.lang.Object that)
Compares the specified object with this list for equality. |
java.lang.Object |
firstElement()
Deprecated. see ariba.util.core.ListUtil.firstElement |
java.lang.Object |
get(int index)
Returns the element at the specified position in this list. |
int |
indexOf(java.lang.Object element)
Finds the location of an element in the Vector. |
int |
indexOf(java.lang.Object element,
int index)
Deprecated. use subList() and indexOf(Object) instead |
int |
indexOfIdentical(java.lang.Object element)
Deprecated. use ListUtil.indexOfIdentical instead |
int |
indexOfIdentical(java.lang.Object element,
int index)
Deprecated. use subList and ListUtil.indexOfIdentical instead |
boolean |
insertElementAfter(java.lang.Object element,
java.lang.Object existingElement)
Deprecated. use ListUtil |
void |
insertElementAt(java.lang.Object element,
int index)
Deprecated. use add(int, Object) instead |
boolean |
insertElementBefore(java.lang.Object element,
java.lang.Object existingElement)
Deprecated. use ListUtil |
boolean |
isEmpty()
Checks if the Vector is empty. |
boolean |
isModifiable()
Deprecated. not supported with Collections.unmodifiableList |
java.lang.Object |
lastElement()
Returns the Vector's last element without modification of the Vector. |
int |
lastIndexOf(java.lang.Object element)
Searches for the last occurrence of the element element in the Vector. |
int |
lastIndexOf(java.lang.Object element,
int index)
Search for the the last index of element in the vector, at or prior to index. |
boolean |
onlyContains(java.lang.Object element)
Checks if the vector contains element and nothing else. |
void |
readExternal(java.io.ObjectInput input)
Reads object data from the given input and restores the contents of this object. |
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list (optional operation). |
boolean |
remove(java.lang.Object element)
Removes the first occurrence of element from the Vector. |
boolean |
removeAll(java.util.Collection c)
Removes from this collection all of its elements that are contained in the specified collection. |
void |
removeAll(java.lang.Object element)
Removes all occurrences of element from the Vector. |
void |
removeAllElements()
Deprecated. use clear |
boolean |
removeElement(java.lang.Object element)
Deprecated. use remove(java.lang.Object) |
java.lang.Object |
removeElementAt(int index)
Deprecated. use remove(int) |
boolean |
removeElementIdentical(java.lang.Object element)
Removes the first occurrence of element from the Vector. |
java.lang.Object |
removeFirstElement()
Removes and returns the element at index 0, or null if the Vector is empty. |
java.lang.Object |
removeLastElement()
Removes and returns the element at index count() - 1 (the last object) or null if the Vector is empty. |
void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive. |
java.lang.Object |
replaceElement(java.lang.Object oldElement,
java.lang.Object newElement)
Deprecated. use ListUtil.replace |
java.lang.Object |
replaceElementAt(int index,
java.lang.Object element)
Deprecated. use set |
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with the specified element. |
void |
setElementAt(java.lang.Object element,
int index)
Sets the element at index to element. |
void |
setUnmodifiable()
Deprecated. use Collections.unmodifiableList |
int |
size()
Returns the number of elements in the Vector. |
void |
sort(boolean ascending)
Deprecated. use ListUtil.sortStrings(List, boolean) |
void |
sortStrings(boolean ascending,
boolean ignoreCase)
Deprecated. use ListUtil.sortStrings(List, boolean, boolean) |
java.lang.String |
toString()
Returns the Vector's string representation. |
void |
trimToSize()
Deprecated. callers should not worry about internal storage details. |
void |
writeExternal(java.io.ObjectOutput output)
Writes this Vector's data out to the given stream. |
Methods inherited from class java.util.AbstractList |
---|
addAll, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public Vector()
ListUtil.list()
public Vector(int initialCapacity)
initialCapacity
- the initial capacity; must be greater
than or equal to zeroListUtil.list(int)
public Vector(java.lang.Object[] array, boolean copy)
array
- the array to use as the initial contents of the
vectorcopy
- if true, the array is copied; if false
the array is shared. However internal Vector operations
may copy or modify the array at a later point, so sharing the
array in a active manner should be avoided.ListUtil.arrayToList(java.lang.Object[], boolean)
public Vector(java.lang.Object[] array)
array
- the array to use as the initial contents of the
vectorListUtil.arrayToList(java.lang.Object[])
public Vector(Vector copy)
copy
- the array to use as the initial contents of the
vectorListUtil.collectionToList(java.util.Collection)
public Vector(java.util.Collection collection)
collection
- collectionListUtil.collectionToList(java.util.Collection)
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public int count()
size()
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
size
in class java.util.AbstractCollection
public boolean isModifiable()
this
is modifiable, that is whether the methods
that change the elements of this instance are supported or not.
For the client, unmodifiability is a promise that the elements of a
Vector
won't change, not that the internal representation
won't change.
Modifiable Vectors
can be made unmodifiable
(see setUnmodifiable()
) but not vice-versa. Setting a
Vector
to be unmodifiable is thus a one-way operation.
Unmodifiable Vectors
are consistent with the JDK 1.2
specification in that they will throw an UnsupportedOperationException if
a mutator method is called.
Modifiable is the default state of Vectors
. All constructors
of this class create modifiable Vectors
. Note that clone()
honors modifiability, that is, clones of unmodifiable Vectors
are unmodifiable.
true
if this
is modifiable,
false
otherwisepublic void setUnmodifiable()
this
to be unmodifiable. This freezes the
Vector
and it cannot subsequently be made modifiable again.
Collections.unmodifiableList(java.util.List)
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
isEmpty
in class java.util.AbstractCollection
public void addElementIfAbsent(java.lang.Object element)
element
- the element to add
java.lang.NullPointerException
- if element is null.ListUtil.addElementIfAbsent(java.util.List, T)
public boolean insertElementBefore(java.lang.Object element, java.lang.Object existingElement)
element
- the element to insert into the vectorexistingElement
- the element to insert before. If
existingElement is null or cannot be found, this
method does nothing
java.lang.NullPointerException
- if element is null.ListUtil.insertElementBefore(java.util.List, T, T)
public boolean insertElementAfter(java.lang.Object element, java.lang.Object existingElement)
element
- the element to insert into the vectorexistingElement
- the element to insert after. If
existingElement is null or cannot be found, this
method does nothing
java.lang.NullPointerException
- if element is null.ListUtil.insertElementAfter(java.util.List, T, T)
public void addElementsIfAbsent(Vector aVector)
aVector
- a vector of the elements to be added to this vectorListUtil.addElementsIfAbsent(java.util.List, java.util.Collection extends T>)
public void addElements(Vector aVector)
aVector
- a vector of the elements to be added to this vectoraddAll(java.util.Collection)
public void removeAll(java.lang.Object element)
element
- the element to remove.public java.lang.Object removeFirstElement()
public java.lang.Object removeLastElement()
public java.lang.Object replaceElementAt(int index, java.lang.Object element)
index
- the location of the element to replaceelement
- the element to replace the existing element with
java.lang.ArrayIndexOutOfBoundsException
- if index is
an illegal index value.
java.lang.NullPointerException
- if element is
nullset(int, java.lang.Object)
public java.lang.Object replaceElement(java.lang.Object oldElement, java.lang.Object newElement)
oldElement
- which element to replacenewElement
- the element to replace the existing element with
java.lang.NullPointerException
- if newElement is
nullListUtil.replace(java.util.List,java.lang.Object,java.lang.Object)
public java.lang.Object[] elementArray()
AbstractCollection.toArray()
public java.lang.Object[] elementArrayNoCopy()
toArray
clear
and
addElements(ListUtil.arrayToList(Object[]))
Vector
even if it is
unmodifiable. Use this method with caution.
public void copyInto(java.lang.Object[] anArray)
anArray
- the array to copy the Vector's elements
into. Any elements existing in anArray beyond the count
of elements in this Vector are left unchanged.AbstractCollection.toArray(java.lang.Object[])
public void copyInto(java.lang.Object[] anArray, int startingAt)
anArray
- the array to copy the Vector's elements
into. Any elements existing in anArray beyond the count
of elements copied from this Vector are left unchanged.startingAt
- the location in anArray to begin
copying intoListUtil.copyInto(java.util.List, java.lang.Object[], int)
public void trimToSize()
count
,
elementArray()
public void ensureCapacity(int minCapacity)
minCapacity
- the number of elements that this Vector can
hold without having to grow it's internal storage.public int capacity()
public java.util.Enumeration elements()
AbstractList.iterator()
public java.util.Enumeration elements(int index)
index
- the index of the first element to be used in the
iteration
AbstractList.listIterator(int)
public boolean contains(java.lang.Object element)
contains
in interface java.util.Collection
contains
in interface java.util.List
contains
in class java.util.AbstractCollection
element
- the element to search for
public boolean onlyContains(java.lang.Object element)
element
- the element to check for; It uses
equals() to perform the containment test.
public boolean containsIdentical(java.lang.Object element)
element
- the element to search for; the ==
operator is used for comparison
ListUtil.containsIdentical(java.util.List, T)
public int indexOf(java.lang.Object element)
indexOf
in interface java.util.List
indexOf
in class java.util.AbstractList
element
- the element to search for. The comparison is
performed using equals() with each element.
public int indexOf(java.lang.Object element, int index)
element
- the element to search for. The comparison is
performed using equals() with each element.index
- the offset in the Vector to begin searching
AbstractList.subList(int, int)
,
indexOf(Object)
public int indexOfIdentical(java.lang.Object element, int index)
element
- the element to search for. The comparison is
performed using == with each element.index
- the offset in the Vector to begin searching
ListUtil.indexOfIdentical(java.util.List, T)
,
AbstractList.subList(int, int)
public int indexOfIdentical(java.lang.Object element)
element
- the element to search for. The comparison is
performed using == with each element.
ListUtil.indexOfIdentical(java.util.List, T)
public int lastIndexOf(java.lang.Object element)
lastIndexOf
in interface java.util.List
lastIndexOf
in class java.util.AbstractList
element
- the element to search for. The comparison is
performed using equals() with each element.
public int lastIndexOf(java.lang.Object element, int index)
element
- the element to search for in the Vector. The
comparison is performed using equals() with each
element.index
- the offset in the vector to start searching
backwards from. The search is inclusive of the element at
location index
public java.lang.Object elementAt(int index)
index
- the index of the element in the Vector to return
java.lang.ArrayIndexOutOfBoundsException
- if the index is
greater than or equal to the number of elements in the Vectorget(int)
public java.lang.Object firstElement()
ListUtil.firstElement(java.util.List)
public java.lang.Object lastElement()
public void setElementAt(java.lang.Object element, int index)
element
- the element to place into the Vector at the
specified locationindex
- the location in the vector to place the element.
java.lang.NullPointerException
- if element is null
java.lang.ArrayIndexOutOfBoundsException
- if index is
an illegal index value.public java.lang.Object removeElementAt(int index)
index
- the index of the element in the Vector to remove
java.lang.ArrayIndexOutOfBoundsException
- if index is
an illegal index value.remove(int)
public void insertElementAt(java.lang.Object element, int index)
element
- the element to insert into the Vectorindex
- the location to insert the element at
java.lang.ArrayIndexOutOfBoundsException
- if index is
an illegal index value.
java.lang.NullPointerException
- if element is
null.add(int, java.lang.Object)
public void addElement(java.lang.Object element)
element
- the element to add to the Vector
java.lang.NullPointerException
- if element is
nulladd(Object)
public boolean remove(java.lang.Object element)
remove
in interface java.util.Collection
remove
in interface java.util.List
remove
in class java.util.AbstractCollection
element
- the element to remove from the Vector. The
comparison is performed using equals() with each
element.
public boolean removeElement(java.lang.Object element)
element
- the element to remove from the Vector. The
comparison is performed using equals() with each
element.
public boolean removeElementIdentical(java.lang.Object element)
element
- the element to remove from the Vector. The
comparison is performed using == with each
element.
public void removeAllElements()
clear()
public void sort(boolean ascending)
ascending
- if true the Vector will be sorted in
ascending order, if false in descending order
java.lang.ClassCastException
- if the
Vector's contents are not all Strings, or are not Comparable.ListUtil.sortStrings(List, boolean)
public void sortStrings(boolean ascending, boolean ignoreCase)
ascending
- if true the Vector will be sorted in
ascending order, if false in descending orderignoreCase
- if true the Vector's Strings will be
sorted in a case insensitive manner, if false in a case
sensitive manner
java.lang.ClassCastException
- if the Vector's contents are not
all Strings.ListUtil.sortStrings(List, boolean, boolean)
public java.lang.String toString()
toString
in class java.util.AbstractCollection
public void writeExternal(java.io.ObjectOutput output) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
output
- the stream to write the object to
java.io.IOException
- Includes any I/O exceptions that may occurpublic void readExternal(java.io.ObjectInput input) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
input
- the stream to read data from in order to restore the object
java.io.IOException
- if I/O errors occur
java.lang.ClassNotFoundException
- If the class for an object being
restored cannot be found.public boolean equals(java.lang.Object that)
equals
in interface java.util.Collection
equals
in interface java.util.List
equals
in class java.util.AbstractList
that
- the object to be compared for equality with this list.
public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.AbstractList
index
- index of element to return.
java.lang.IndexOutOfBoundsException
- if the given index is out of range
(index < 0 || index >= size()).public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.AbstractList
index
- index of element to replace.element
- element to be stored at the specified position.
java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.
java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public void add(int index, java.lang.Object element)
add
in interface java.util.List
add
in class java.util.AbstractList
index
- index at which the specified element is to be inserted.element
- element to be inserted.
java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.
java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.
java.lang.IndexOutOfBoundsException
- index is out of range (index <
0 || index > size()).public boolean add(java.lang.Object element)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.AbstractList
element
- element to be appended to this list.
java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this set.
java.lang.IllegalArgumentException
- some aspect of this element prevents
it from being added to this collection.public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.AbstractCollection
c
- a collection of the elements to be added to this vector
public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.AbstractList
index
- the index of the element to remove.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
clear
in class java.util.AbstractList
public void removeRange(int fromIndex, int toIndex)
removeRange
in class java.util.AbstractList
fromIndex
- index of first element to be removed.toIndex
- index after last element to be removed.public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
removeAll
in class java.util.AbstractCollection
c
- elements to be removed from this collection.
remove(Object)
,
contains(Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |