|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<E>
org.knowceans.util.SetVector<E>
public class SetVector<E>
A Collection that implements both the List and the Set interface. Based on the implementation of Vector, this class ensures uniqueness of items. The strategy is conservative, which means duplication between a modifying argument and an existing element will result in avoiding the modification.
| Constructor Summary | |
|---|---|
SetVector()
|
|
SetVector(java.util.Collection<? extends E> c)
Initialise the SetVector, getting rid of duplicate elements where duplicates |
|
SetVector(int initialCapacity)
|
|
SetVector(int initialCapacity,
int capacityIncrement)
|
|
| Method Summary | |
|---|---|
boolean |
add(E o)
adds a new element at the end of the list iff this element does not exist yet in the object. |
void |
add(int index,
E o)
adds a new element at index i iff this element does not exist yet in the object. |
boolean |
addAll(java.util.Collection<? extends E> c)
add all elements from the Collection that are not contained yet in the SetVector to the end of the object. |
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
add all elements from the Collection at the index that are not contained yet in the SetVector. |
void |
addElement(E obj)
same as add(Object). |
void |
insertElementAt(E obj,
int index)
same add add(int, Object). |
static void |
main(java.lang.String[] args)
|
E |
set(int index,
E element)
Replaces the element at the specified position in this Vector with the specified element iff the element uniqueness is obeyed by this operation. |
void |
setElementAt(E obj,
int index)
Replaces the element at the specified position in this Vector with the specified element iff the element uniqueness is obeyed by this operation. |
| Methods inherited from class java.util.Vector |
|---|
capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setSize, size, subList, toArray, toArray, toString, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
iterator, listIterator, listIterator |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
|---|
iterator, listIterator, listIterator |
| Constructor Detail |
|---|
public SetVector()
public SetVector(int initialCapacity)
initialCapacity -
public SetVector(int initialCapacity,
int capacityIncrement)
initialCapacity - capacityIncrement - public SetVector(java.util.Collection<? extends E> c)
c - | Method Detail |
|---|
public void add(int index,
E o)
add in interface java.util.List<E>add in class java.util.Vector<E>public void addElement(E obj)
addElement in class java.util.Vector<E>public boolean add(E o)
add in interface java.util.Collection<E>add in interface java.util.List<E>add in interface java.util.Set<E>add in class java.util.Vector<E>
public void insertElementAt(E obj,
int index)
insertElementAt in class java.util.Vector<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in interface java.util.List<E>addAll in interface java.util.Set<E>addAll in class java.util.Vector<E>
public boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E>addAll in class java.util.Vector<E>
public E set(int index,
E element)
set in interface java.util.List<E>set in class java.util.Vector<E>index - index of element to replace.element - element to be stored at the specified position.
public void setElementAt(E obj,
int index)
setElementAt in class java.util.Vector<E>index - index of element to replace.element - element to be stored at the specified position.public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||