org.apache.tools.ant.util
Class VectorSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by org.apache.tools.ant.util.VectorSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public final class VectorSet
extends java.util.Vector

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
VectorSet()
           
VectorSet(java.util.Collection c)
           
VectorSet(int initialCapacity)
           
VectorSet(int initialCapacity, int capacityIncrement)
           
 
Method Summary
 void add(int index, java.lang.Object o)
          This implementation may not add the element at the given index if it is already contained in the collection.
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
          This implementation may not add all elements at the given index if any of them are already contained in the collection.
 void addElement(java.lang.Object o)
           
 void clear()
           
 java.lang.Object clone()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 void insertElementAt(java.lang.Object o, int index)
           
 java.lang.Object 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)
           
 java.lang.Object set(int index, java.lang.Object o)
           
 void setElementAt(java.lang.Object o, int index)
           
 
Methods inherited from class java.util.Vector
capacity, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

VectorSet

public VectorSet()

VectorSet

public VectorSet(int initialCapacity)

VectorSet

public VectorSet(int initialCapacity,
                 int capacityIncrement)

VectorSet

public VectorSet(java.util.Collection c)
Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List
Overrides:
add in class java.util.Vector

add

public void add(int index,
                java.lang.Object 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 java.util.List
Overrides:
add in class java.util.Vector

addElement

public void addElement(java.lang.Object o)
Overrides:
addElement in class java.util.Vector

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.List
Overrides:
addAll in class java.util.Vector

addAll

public boolean addAll(int index,
                      java.util.Collection 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 java.util.List
Overrides:
addAll in class java.util.Vector

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
Overrides:
clear in class java.util.Vector

clone

public java.lang.Object clone()
Overrides:
clone in class java.util.Vector

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.List
Overrides:
contains in class java.util.Vector

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.List
Overrides:
containsAll in class java.util.Vector

insertElementAt

public void insertElementAt(java.lang.Object o,
                            int index)
Overrides:
insertElementAt in class java.util.Vector

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List
Overrides:
remove in class java.util.Vector

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.List
Overrides:
remove in class java.util.Vector

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.List
Overrides:
removeAll in class java.util.Vector

removeAllElements

public void removeAllElements()
Overrides:
removeAllElements in class java.util.Vector

removeElement

public boolean removeElement(java.lang.Object o)
Overrides:
removeElement in class java.util.Vector

removeElementAt

public void removeElementAt(int index)
Overrides:
removeElementAt in class java.util.Vector

removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Overrides:
removeRange in class java.util.Vector

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.List
Overrides:
retainAll in class java.util.Vector

set

public java.lang.Object set(int index,
                            java.lang.Object o)
Specified by:
set in interface java.util.List
Overrides:
set in class java.util.Vector

setElementAt

public void setElementAt(java.lang.Object o,
                         int index)
Overrides:
setElementAt in class java.util.Vector