|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.ArrayList<E> org.knowceans.util.SetArrayList<E>
public class SetArrayList<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 | |
---|---|
SetArrayList()
|
|
SetArrayList(java.util.Collection<? extends E> c)
Initialise the SetVector, getting rid of duplicate elements where duplicates |
|
SetArrayList(int initialCapacity)
|
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. |
void |
addElement(E obj)
same as add(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.ArrayList |
---|
addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, removeAll, retainAll, toString |
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 |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public SetArrayList()
public SetArrayList(int initialCapacity)
initialCapacity
- public SetArrayList(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.ArrayList<E>
public void addElement(E obj)
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.ArrayList<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.ArrayList<E>
public E set(int index, E element)
set
in interface java.util.List<E>
set
in class java.util.ArrayList<E>
index
- index of element to replace.element
- element to be stored at the specified position.
public void setElementAt(E obj, int index)
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 |