org.apache.tools.ant.utilClass VectorSet<E>
- java.lang.Object
- java.util.AbstractCollection<E>
- java.util.AbstractList<E>
- java.util.Vector<E>
- org.apache.tools.ant.util.VectorSet<E>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess
public final class VectorSet<E> extends java.util.Vector<E>
Subclass of Vector that won't store duplicate entries and shows HashSet's constant time performance characteristics for the contains method.This is not a general purpose class but has been written because the protected members of
DirectoryScanner
prohibited later revisions from using a more efficient collection.Methods are synchronized to keep Vector's contract.
- Since:
- Ant 1.8.0
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor and Description VectorSet()
VectorSet(java.util.Collection<? extends E> c)
VectorSet(int initialCapacity)
VectorSet(int initialCapacity, int capacityIncrement)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
add(E o)
void
add(int index, E o)
This implementation may not add the element at the given index if it is already contained in the collection.boolean
addAll(java.util.Collection<? extends E> c)
boolean
addAll(int index, java.util.Collection<? extends E> c)
This implementation may not add all elements at the given index if any of them are already contained in the collection.void
addElement(E o)
void
clear()
java.lang.Object
clone()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
void
insertElementAt(E o, int index)
E
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
void
removeAllElements()
boolean
removeElement(java.lang.Object o)
void
removeElementAt(int index)
void
removeRange(int fromIndex, int toIndex)
boolean
retainAll(java.util.Collection<?> c)
E
set(int index, E o)
void
setElementAt(E o, int index)
Methods inherited from class java.util.Vector
capacity, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
Constructor Detail
VectorSet
public VectorSet()
VectorSet
public VectorSet(int initialCapacity)
VectorSet
public VectorSet(int initialCapacity, int capacityIncrement)
VectorSet
public VectorSet(java.util.Collection<? extends E> c)
Method Detail
add
public boolean add(E o)
add
public void add(int index, E o)This implementation may not add the element at the given index if it is already contained in the collection.
addAll
public boolean addAll(java.util.Collection<? extends E> c)
addAll
public boolean addAll(int index, java.util.Collection<? extends E> c)This implementation may not add all elements at the given index if any of them are already contained in the collection.
clear
public void clear()
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.util.Vector<E>
contains
public boolean contains(java.lang.Object o)
containsAll
public boolean containsAll(java.util.Collection<?> c)
insertElementAt
public void insertElementAt(E o, int index)
- Overrides:
insertElementAt
in classjava.util.Vector<E>
remove
public E remove(int index)
remove
public boolean remove(java.lang.Object o)
removeAll
public boolean removeAll(java.util.Collection<?> c)
removeAllElements
public void removeAllElements()
- Overrides:
removeAllElements
in classjava.util.Vector<E>
removeElement
public boolean removeElement(java.lang.Object o)
- Overrides:
removeElement
in classjava.util.Vector<E>
removeElementAt
public void removeElementAt(int index)
- Overrides:
removeElementAt
in classjava.util.Vector<E>
removeRange
public void removeRange(int fromIndex, int toIndex)
- Overrides:
removeRange
in classjava.util.Vector<E>
retainAll
public boolean retainAll(java.util.Collection<?> c)