Package org.apache.tools.ant.util

# Class 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:
  `Serializable`, `Cloneable`, `Iterable<E>`, `Collection<E>`, `List<E>`, `RandomAccess`

public final class VectorSet<E> extends 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

## Field Summary

### Fields inherited from class java.util.Vector

`capacityIncrement, elementCount, elementData`

### Fields inherited from class java.util.AbstractList

`modCount`

## Constructor Summary

Constructors
Constructor
Description
`VectorSet()`
`VectorSet(int initialCapacity)`
`VectorSet(int initialCapacity, int capacityIncrement)`
`VectorSet(Collection<? extends E> c)`

## Method Summary

Modifier and Type
Method
Description
`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`
`add(E o)`
`boolean`
`addAll(int index, 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.
`boolean`
`addAll(Collection<? extends E> c)`
`void`
`addElement(E o)`
`void`
`clear()`
`Object`
`clone()`
`boolean`
`contains(Object o)`
`boolean`
`containsAll(Collection<?> c)`
`void`
`insertElementAt(E o, int index)`
`E`
`remove(int index)`
`boolean`
`remove(Object o)`
`boolean`
`removeAll(Collection<?> c)`
`void`
`removeAllElements()`
`boolean`
`removeElement(Object o)`
`void`
`removeElementAt(int index)`
`void`
`removeRange(int fromIndex, int toIndex)`
`boolean`
`retainAll(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`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Collection

`parallelStream, stream, toArray`

## Constructor Details

### VectorSet

public VectorSet()

### VectorSet

public VectorSet(int initialCapacity)

### VectorSet

public VectorSet(int initialCapacity, int capacityIncrement)

### VectorSet

public VectorSet(Collection<? extends E> c)

## Method Details

### add

public boolean add(E o)

Specified by:
  `add` in interface `Collection<E>`
Specified by:
  `add` in interface `List<E>`
Overrides:
  `add` in class `Vector<E>`

### 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.

Specified by:
  `add` in interface `List<E>`
Overrides:
  `add` in class `Vector<E>`

### addElement

public void addElement(E o)

Overrides:
  `addElement` in class `Vector<E>`

### addAll

public boolean addAll(Collection<? extends E> c)

Specified by:
  `addAll` in interface `Collection<E>`
Specified by:
  `addAll` in interface `List<E>`
Overrides:
  `addAll` in class `Vector<E>`

### addAll

public boolean addAll(int index, 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.

Specified by:
  `addAll` in interface `List<E>`
Overrides:
  `addAll` in class `Vector<E>`

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<E>`
Specified by:
  `clear` in interface `List<E>`
Overrides:
  `clear` in class `Vector<E>`

### clone

public Object clone()

Overrides:
  `clone` in class `Vector<E>`

### contains

public boolean contains(Object o)

Specified by:
  `contains` in interface `Collection<E>`
Specified by:
  `contains` in interface `List<E>`
Overrides:
  `contains` in class `Vector<E>`

### containsAll

public boolean containsAll(Collection<?> c)

Specified by:
  `containsAll` in interface `Collection<E>`
Specified by:
  `containsAll` in interface `List<E>`
Overrides:
  `containsAll` in class `Vector<E>`

### insertElementAt

public void insertElementAt(E o, int index)

Overrides:
  `insertElementAt` in class `Vector<E>`

### remove

public E remove(int index)

Specified by:
  `remove` in interface `List<E>`
Overrides:
  `remove` in class `Vector<E>`

### remove

public boolean remove(Object o)

Specified by:
  `remove` in interface `Collection<E>`
Specified by:
  `remove` in interface `List<E>`
Overrides:
  `remove` in class `Vector<E>`

### removeAll

public boolean removeAll(Collection<?> c)

Specified by:
  `removeAll` in interface `Collection<E>`
Specified by:
  `removeAll` in interface `List<E>`
Overrides:
  `removeAll` in class `Vector<E>`

### removeAllElements

public void removeAllElements()

Overrides:
  `removeAllElements` in class `Vector<E>`

### removeElement

public boolean removeElement(Object o)

Overrides:
  `removeElement` in class `Vector<E>`

### removeElementAt

public void removeElementAt(int index)

Overrides:
  `removeElementAt` in class `Vector<E>`

### removeRange

public void removeRange(int fromIndex, int toIndex)

Overrides:
  `removeRange` in class `Vector<E>`

### retainAll

public boolean retainAll(Collection<?> c)

Specified by:
  `retainAll` in interface `Collection<E>`
Specified by:
  `retainAll` in interface `List<E>`
Overrides:
  `retainAll` in class `Vector<E>`

### set

public E set(int index, E o)

Specified by:
  `set` in interface `List<E>`
Overrides:
  `set` in class `Vector<E>`

### setElementAt

public void setElementAt(E o, int index)

Overrides:
  `setElementAt` in class `Vector<E>`