class UniqueVector<T> extends Object
Modifier and Type | Field and Description |
---|---|
private HashSet<T> |
elementSet |
private Vector<T> |
elementVector |
Constructor and Description |
---|
UniqueVector()
Creates a new vector
|
Modifier and Type | Method and Description |
---|---|
void |
add(T o)
Add an object o to the vector if it is not already present as defined by
the function HashSet.contains(o)
|
void |
addArray(T[] a)
Appends all elements of an array to this vector.
|
void |
addVector(UniqueVector<T> v)
Appends all elements of a vector to this vector.
|
boolean |
contains(T o)
Checks if an element is present in the vector.
|
Collection<T> |
elements()
Returns the entries of this vector.
|
T |
get(int index)
Gets an element from a vector.
|
int |
size()
Gets the number of elements currently in vector.
|
T[] |
toArray()
Creates an array of the elements in the vector.
|
T[] |
toArray(T[] a)
Creates an array of the elements in the vector.
|
private HashSet<T> elementSet
private Vector<T> elementVector
public UniqueVector()
public void add(T o)
o
- the object to addpublic void addVector(UniqueVector<T> v)
v
- the vector to addpublic void addArray(T[] a)
a
- the array to addpublic int size()
public boolean contains(T o)
o
- the object to checkpublic T get(int index)
index
- the index into the vector from which to retrieve the elementpublic T[] toArray()
public T[] toArray(T[] a)
public Collection<T> elements()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses