Collections
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final Vector | EMPTY_VECTOR
The empty vector (immutable). |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static final < type of elements, if there were any, in the vector T> Vector | Returns: an empty immutable vector Implementation Note: Implementations of this method need not create a separateVector
object for each call. Using this method is likely to have comparable
cost to using the like-named field. (Unlike this method, the field does
not provide type safety.)Returns an empty vector (immutable). |
| public static < the class of the objects in the vector T> Vector | Returns: an unmodifiable view of the specified vector.the vector for which an unmodifiable view is to be returned. vector)Returns an unmodifiable view of the specified vector. |
| EMPTY_VECTOR | back to summary |
|---|---|
| public static final Vector<E> EMPTY_VECTOR The empty vector (immutable).
| |
| VectorUtils | back to summary |
|---|---|
| private VectorUtils() | |
| emptyVector | back to summary |
|---|---|
| public static final <T> Vector Returns an empty vector (immutable). This example illustrates the type-safe way to obtain an empty vector:
Vector<String> s = VectorUtils.emptyVector();
| |
| unmodifiableVector | back to summary |
|---|---|
| public static <T> Vector Returns an unmodifiable view of the specified vector. This method allows
modules to provide users with "read-only" access to internal
vectors. Query operations on the returned vector "read through" to the
specified vector, and attempts to modify the returned vector, whether
direct or via its iterator, result in an
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(int
index at which the specified element is to be inserted index, E element to be inserted element)Overrides java. Implements java. |
| public boolean | contains(Object
element whose presence in this vector is to be tested obj)Overrides java. Implements java. true if this vector contains the specified element.
|
| public boolean | containsAll(Collection<?>
a collection whose elements will be tested for containment
in this Vector c)Overrides java. Implements java. |
| public boolean | equals(Object
the Object to be compared for equality with this Vector o)Overrides java. Implements java. |
| public void | forEach(Consumer<? super E>
The action to be performed for each element action)Overrides java. Overrides default java. Iterable
until all elements have been processed or the action throws an
exception.
|
| public E | get(int
index of the element to return index)Overrides java. Implements java. |
| public int | hashCode()
Overrides java. Implements java. |
| public boolean | isEmpty()
Overrides java. Implements java. |
| public Iterator | iterator()
Overrides java. Implements java. |
| public ListIterator | listIterator(int
index of the first element to be returned from the
list iterator (by a call to index)next)Overrides java. Implements java. |
| public ListIterator | listIterator()
Overrides java. Implements java. |
| private Object | |
| public boolean | removeIf(Predicate<? super E>
a predicate which returns filter)true for elements to be
removedOverrides java. Overrides default java. |
| public void | replaceAll(UnaryOperator<E>
the operator to apply to each element operator)Overrides java. Overrides default java. |
| public int | size()
Overrides java. Implements java. |
| public void | sort(Comparator<? super E>
the c)Comparator used to compare list elements.
A null value indicates that the elements'
natural ordering should be usedOverrides java. Overrides default java. Comparator.
|
| public Spliterator | spliterator()
Overrides java. Overrides default java. Spliterator over the elements in this
list.
|
| public Object[] | toArray()
Overrides java. Implements java. |
| public <T> T[] | toArray(T[]
the array into which the elements of the Vector are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose. a)Overrides java. Implements java. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| EmptyVector | back to summary |
|---|---|
| private EmptyVector() | |
| add | back to summary |
|---|---|
| public void add(int index, E element) Overrides java. Implements java. Doc from java. Inserts the specified element at the specified position in this Vector. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object obj) Overrides java. Implements java. Doc from java. Returns | |
| containsAll | back to summary |
|---|---|
| public boolean containsAll(Collection<?> c) Overrides java. Implements java. Doc from java. Returns true if this Vector contains all of the elements in the specified Collection.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements java. Doc from java. Compares the specified Object with this Vector for equality. Returns
true if and only if the specified Object is also a List, both Lists
have the same size, and all corresponding pairs of elements in the two
Lists are equal. (Two elements | |
| forEach | back to summary |
|---|---|
| public void forEach(Consumer<? super E> action) Overrides java. Overrides default java. Doc from java. Performs the given action for each element of the The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy. | |
| get | back to summary |
|---|---|
| public E get(int index) Overrides java. Implements java. Doc from java. Returns the element at the specified position in this Vector.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this Vector.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Doc from java. Tests if this vector has no components.
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides java. Implements java. Doc from java. Returns an iterator over the elements in this list in proper sequence. The returned iterator is fail-fast. | |
| listIterator | back to summary |
|---|---|
| public ListIterator Overrides java. Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper
sequence), starting at the specified position in the list.
The specified index indicates the first element that would be
returned by an initial call to The returned list iterator is fail-fast.
| |
| listIterator | back to summary |
|---|---|
| public ListIterator Overrides java. Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper sequence). The returned list iterator is fail-fast.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() | |
| removeIf | back to summary |
|---|---|
| public boolean removeIf(Predicate<? super E> filter) Overrides java. Overrides default java. Doc from java. Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller. | |
| replaceAll | back to summary |
|---|---|
| public void replaceAll(UnaryOperator<E> operator) Overrides java. Overrides default java. Doc from java. Replaces each element of this list with the result of applying the operator to that element. Errors or runtime exceptions thrown by the operator are relayed to the caller.
| |
| size | back to summary |
|---|---|
| public int size() Overrides java. Implements java. Doc from java. Returns the number of components in this vector.
| |
| sort | back to summary |
|---|---|
| public void sort(Comparator<? super E> c) Overrides java. Overrides default java. Doc from java. Sorts this list according to the order induced by the specified
All elements in this list must be mutually comparable using the
specified comparator (that is, If the specified comparator is This list must be modifiable, but need not be resizable.
| |
| spliterator | back to summary |
|---|---|
| public Spliterator Overrides java. Overrides default java. Doc from java. Creates a late-binding
and fail-fast The
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this Vector in the correct order.
| |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(T[] a) Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this Vector in the correct order; the runtime type of the returned array is that of the specified array. If the Vector fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this Vector. If the Vector fits in the specified array with room to spare (i.e., the array has more elements than the Vector), the element in the array immediately following the end of the Vector is set to null. (This is useful in determining the length of the Vector only if the caller knows that the Vector does not contain any null elements.)
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(int
index at which the specified element is to be inserted index, E element to be inserted element)Overrides java. Implements java. |
| public boolean | addAll(int
index at which to insert the first element from the
specified collection index, Collection<? extends E> elements to be inserted into this Vector c)Overrides java. Implements java. |
| public ListIterator | listIterator(final int
index of the first element to be returned from the
list iterator (by a call to index)next)Overrides java. Implements java. |
| public ListIterator | listIterator()
Overrides java. Implements java. |
| public E | remove(int
the index of the element to be removed index)Overrides java. Implements java. |
| public void | replaceAll(UnaryOperator<E>
the operator to apply to each element operator)Overrides java. Overrides default java. |
| public E | set(int
index of the element to replace index, E element to be stored at the specified position element)Overrides java. Implements java. |
| public void | sort(Comparator<? super E>
the c)Comparator used to compare list elements.
A null value indicates that the elements'
natural ordering should be usedOverrides java. Overrides default java. Comparator.
|
| public List | subList(int
low endpoint (inclusive) of the subList fromIndex, int high endpoint (exclusive) of the subList toIndex)Overrides java. Implements java. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| UnmodifiableVector | back to summary |
|---|---|
| pack-priv UnmodifiableVector(Vector<? extends E> vector) | |
| add | back to summary |
|---|---|
| public void add(int index, E element) Overrides java. Implements java. Doc from java. Inserts the specified element at the specified position in this Vector. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(int index, Collection<? extends E> c) Overrides java. Implements java. Doc from java. Inserts all of the elements in the specified Collection into this Vector at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the Vector in the order that they are returned by the specified Collection's iterator.
| |
| listIterator | back to summary |
|---|---|
| public ListIterator Overrides java. Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper
sequence), starting at the specified position in the list.
The specified index indicates the first element that would be
returned by an initial call to The returned list iterator is fail-fast.
| |
| listIterator | back to summary |
|---|---|
| public ListIterator Overrides java. Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper sequence). The returned list iterator is fail-fast.
| |
| remove | back to summary |
|---|---|
| public E remove(int index) Overrides java. Implements java. Doc from java. Removes the element at the specified position in this Vector. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the Vector.
| |
| replaceAll | back to summary |
|---|---|
| public void replaceAll(UnaryOperator<E> operator) Overrides java. Overrides default java. Doc from java. Replaces each element of this list with the result of applying the operator to that element. Errors or runtime exceptions thrown by the operator are relayed to the caller.
| |
| set | back to summary |
|---|---|
| public E set(int index, E element) Overrides java. Implements java. Doc from java. Replaces the element at the specified position in this Vector with the specified element.
| |
| sort | back to summary |
|---|---|
| public void sort(Comparator<? super E> c) Overrides java. Overrides default java. Doc from java. Sorts this list according to the order induced by the specified
All elements in this list must be mutually comparable using the
specified comparator (that is, If the specified comparator is This list must be modifiable, but need not be resizable.
| |
| subList | back to summary |
|---|---|
| public List Overrides java. Implements java. Doc from java. Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned List is empty.) The returned List is backed by this List, so changes in the returned List are reflected in this List, and vice-versa. The returned List supports all of the optional List operations supported by this List. This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a List can be used as a range operation by operating on a subList view instead of a whole List. For example, the following idiom removes a range of elements from a List:
list.subList(from, to).clear();
Similar idioms may be constructed for indexOf and lastIndexOf,
and all of the algorithms in the Collections class can be applied to
a subList.
The semantics of the List returned by this method become undefined if the backing list (i.e., this List) is structurally modified in any way other than via the returned List. (Structural modifications are those that change the size of the List, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.) | |