|
||||||||||
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.ArrayList<T>
cz.psika.utils.UniqueArrayList<T>
T
- list item typepublic class UniqueArrayList<T>
Extended ArrayList class to hold unique values only. Use method 'add' only, which is safe enough, some other methods should be overloaded to achieve proper extended functionality. Code retrieved from dangertree techblog (http://weblog.dangertree.net/2007/06/09/unique-arraylist/) and slightly modified to make it compilable and as much simple as possible.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
UniqueArrayList()
|
Method Summary | |
---|---|
boolean |
add(T obj)
Add the object to the list if there is no other copy of it. |
Methods inherited from class java.util.ArrayList |
---|
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode |
Constructor Detail |
---|
public UniqueArrayList()
Method Detail |
---|
public boolean add(T obj)
null
are ignored.
add
in interface java.util.Collection<T>
add
in interface java.util.List<T>
add
in class java.util.ArrayList<T>
obj
- item of list
true
on success, false
when item already exists in the list or null
value given
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |