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:
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
  • 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​(java.util.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, 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.
    boolean addAll​(java.util.Collection<? extends E> c)  
    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

    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​(java.util.Collection<? extends E> c)
  • Method Details

    • add

      public boolean add​(E o)
      Specified by:
      add in interface java.util.Collection<E>
      Specified by:
      add in interface java.util.List<E>
      Overrides:
      add in class java.util.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 java.util.List<E>
      Overrides:
      add in class java.util.Vector<E>
    • addElement

      public void addElement​(E o)
      Overrides:
      addElement in class java.util.Vector<E>
    • addAll

      public boolean addAll​(java.util.Collection<? extends E> c)
      Specified by:
      addAll in interface java.util.Collection<E>
      Specified by:
      addAll in interface java.util.List<E>
      Overrides:
      addAll in class java.util.Vector<E>
    • 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.
      Specified by:
      addAll in interface java.util.List<E>
      Overrides:
      addAll in class java.util.Vector<E>
    • clear

      public void clear()
      Specified by:
      clear in interface java.util.Collection<E>
      Specified by:
      clear in interface java.util.List<E>
      Overrides:
      clear in class java.util.Vector<E>
    • clone

      public java.lang.Object clone()
      Overrides:
      clone in class java.util.Vector<E>
    • contains

      public boolean contains​(java.lang.Object o)
      Specified by:
      contains in interface java.util.Collection<E>
      Specified by:
      contains in interface java.util.List<E>
      Overrides:
      contains in class java.util.Vector<E>
    • containsAll

      public boolean containsAll​(java.util.Collection<?> c)
      Specified by:
      containsAll in interface java.util.Collection<E>
      Specified by:
      containsAll in interface java.util.List<E>
      Overrides:
      containsAll in class java.util.Vector<E>
    • insertElementAt

      public void insertElementAt​(E o, int index)
      Overrides:
      insertElementAt in class java.util.Vector<E>
    • remove

      public E remove​(int index)
      Specified by:
      remove in interface java.util.List<E>
      Overrides:
      remove in class java.util.Vector<E>
    • remove

      public boolean remove​(java.lang.Object o)
      Specified by:
      remove in interface java.util.Collection<E>
      Specified by:
      remove in interface java.util.List<E>
      Overrides:
      remove in class java.util.Vector<E>
    • removeAll

      public boolean removeAll​(java.util.Collection<?> c)
      Specified by:
      removeAll in interface java.util.Collection<E>
      Specified by:
      removeAll in interface java.util.List<E>
      Overrides:
      removeAll in class java.util.Vector<E>
    • removeAllElements

      public void removeAllElements()
      Overrides:
      removeAllElements in class java.util.Vector<E>
    • removeElement

      public boolean removeElement​(java.lang.Object o)
      Overrides:
      removeElement in class java.util.Vector<E>
    • removeElementAt

      public void removeElementAt​(int index)
      Overrides:
      removeElementAt in class java.util.Vector<E>
    • removeRange

      public void removeRange​(int fromIndex, int toIndex)
      Overrides:
      removeRange in class java.util.Vector<E>
    • retainAll

      public boolean retainAll​(java.util.Collection<?> c)
      Specified by:
      retainAll in interface java.util.Collection<E>
      Specified by:
      retainAll in interface java.util.List<E>
      Overrides:
      retainAll in class java.util.Vector<E>
    • set

      public E set​(int index, E o)
      Specified by:
      set in interface java.util.List<E>
      Overrides:
      set in class java.util.Vector<E>
    • setElementAt

      public void setElementAt​(E o, int index)
      Overrides:
      setElementAt in class java.util.Vector<E>