public class BufOrderedVector
extends java.util.Vector
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
changeIterateLastListSyncObj |
protected java.util.List |
iterateLastList |
protected java.util.List |
iteratorBufList |
Constructor and Description |
---|
BufOrderedVector()
Constructs an empty vector so that its internal data array
has size 10 and its standard capacity increment is
zero.
|
BufOrderedVector(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.
|
BufOrderedVector(int initialCapacity)
Constructs an empty vector with the specified initial capacity and
with its capacity increment equal to zero.
|
BufOrderedVector(int initialCapacity,
int capacityIncrement)
Constructs an empty vector with the specified initial capacity and
capacity increment.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object o)
Appends the specified element to the end of this Vector.
|
boolean |
addAll(java.util.Collection c)
Appends all of the elements in the specified Collection to the end of
this Vector, in the order that they are returned by the specified
Collection's Iterator.
|
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.
|
void |
addElement(java.lang.Object obj)
Adds the specified component to the end of this vector,
increasing its size by one.
|
void |
clearIterateLastList()
Clears the iterate-last list.
|
void |
copyInto(java.lang.Object[] anArray)
Copies the components of this vector into the specified array.
|
java.lang.Object |
getIterateLastListItem(int idx)
Returns the item at the specified index in the iterate-last list.
|
void |
insertElementAt(java.lang.Object obj,
int index)
Inserts the specified object as a component in this vector at the
specified
index . |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this list in proper sequence.
|
java.util.ListIterator |
listIterator()
Returns a list iterator of the elements in this list (in proper
sequence).
|
java.util.ListIterator |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper
sequence), starting at the specified position in this list.
|
java.lang.Object |
remove(int index)
Removes the element at the specified position in this Vector.
|
boolean |
removeAll(java.util.Collection c)
Removes from this Vector all of its elements that are contained in the
specified Collection.
|
void |
removeAllElements()
Removes all components from this vector and sets its size to zero.
|
boolean |
removeElement(java.lang.Object obj)
Removes the first (lowest-indexed) occurrence of the argument
from this vector.
|
void |
removeElementAt(int index)
Deletes the component at the specified index.
|
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this Vector that are contained in the
specified Collection.
|
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this Vector with the
specified element.
|
void |
setElementAt(java.lang.Object obj,
int index)
Sets the component at the specified
index of this
vector to be the specified object. |
void |
setIterateLastListItem(int idx,
java.lang.Object itemObj)
Enters the given item into the iterate-last list at the given
position.
|
void |
setSize(int newSize)
Sets the size of this vector.
|
protected void |
syncIteratorBufList()
Synchronizes the buffered list for iterators.
|
add, capacity, clear, clone, contains, containsAll, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeIf, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
protected java.util.List iteratorBufList
protected java.util.List iterateLastList
protected final java.lang.Object changeIterateLastListSyncObj
public BufOrderedVector(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 negative.public BufOrderedVector(int initialCapacity)
initialCapacity
- the initial capacity of the vector.java.lang.IllegalArgumentException
- if the specified initial capacity
is negativepublic BufOrderedVector()
public BufOrderedVector(java.util.Collection c)
c
- the collection whose elements are to be placed into this
vector.public void copyInto(java.lang.Object[] anArray)
copyInto
in class java.util.Vector
anArray
- the array into which the components get copied.public void setSize(int newSize)
null
items are added to the end of
the vector. If the new size is less than the current size, all
components at index newSize
and greater are discarded.setSize
in class java.util.Vector
newSize
- the new size of this vector.java.lang.ArrayIndexOutOfBoundsException
- if new size is negative.public void setElementAt(java.lang.Object obj, int index)
index
of this
vector to be the specified object. 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.
setElementAt
in class java.util.Vector
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)
public void removeElementAt(int index)
index
is shifted downward to have an index one
smaller than the value it had previously. The size of this vector
is decreased by 1.
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 remove method (which is part of the List interface). Note that the remove method returns the old value that was stored at the specified position.
removeElementAt
in class java.util.Vector
index
- the index of the object to remove.java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.Vector.size()
,
remove(int)
,
List
public void insertElementAt(java.lang.Object obj, int index)
index
. 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.
insertElementAt
in class java.util.Vector
obj
- the component to insert.index
- where to insert the new component.java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.Vector.size()
,
Vector.add(int, Object)
,
List
public void addElement(java.lang.Object obj)
This method is identical in functionality to the add(Object) method (which is part of the List interface).
addElement
in class java.util.Vector
obj
- the component to be added.add(Object)
,
List
public boolean removeElement(java.lang.Object obj)
This method is identical in functionality to the remove(Object) method (which is part of the List interface).
removeElement
in class java.util.Vector
obj
- the component to be removed.true
if the argument was a component of this
vector; false
otherwise.List.remove(Object)
,
List
public void removeAllElements()
This method is identical in functionality to the clear method (which is part of the List interface).
removeAllElements
in class java.util.Vector
Vector.clear()
,
List
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.Vector
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 boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.Vector
o
- element to be appended to this Vector.public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.Vector
index
- the index of the element to removed.java.lang.ArrayIndexOutOfBoundsException
- index out of range (index
< 0 || index >= size()).public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.Vector
c
- elements to be inserted into this Vector.java.lang.ArrayIndexOutOfBoundsException
- index out of range (index
< 0 || index > size()).public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
removeAll
in class java.util.Vector
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
retainAll
in class java.util.Vector
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
addAll
in class java.util.Vector
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 java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
iterator
in class java.util.Vector
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
listIterator
in class java.util.Vector
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
listIterator
in class java.util.Vector
index
- index of first element to be returned from the
list iterator (by a call to the next method).java.lang.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index > size()).protected final void syncIteratorBufList()
public void setIterateLastListItem(int idx, java.lang.Object itemObj)
idx
- index position for new item.itemObj
- item to enter, or 'null' to remove item at
given index position.public java.lang.Object getIterateLastListItem(int idx)
idx
- index position for the returned item.public void clearIterateLastList()