E - The type of the element in this ListSet.public class ListSet<E> extends AbstractCollection<E> implements Set<E>
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
protected List<E> |
list |
protected Set<E> |
set |
| Constructor and Description |
|---|
ListSet()
Constructs a new, empty list set.
|
ListSet(Comparator<? super E> comparator)
Constructs a new, empty list set, sorted according to the specified
comparator.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
get(int index) |
E |
get(int index,
E defaultValue) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
addAll, removeAll, toStringpublic ListSet()
public ListSet(Comparator<? super E> comparator)
comparator.compare(e1,
e2) must not throw a ClassCastException for any elements
e1 and e2 in the set. If the user attempts to add
an element to the set that violates this constraint, the
add call will throw a ClassCastException.comparator - the comparator that will be used to order this set.
If null, the natural
ordering of the elements will be used.public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public E remove(int index)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>containsAll in class AbstractCollection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface Set<E>retainAll in class AbstractCollection<E>public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>public E get(int index)
public Object[] toArray()
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface Set<E>toArray in class AbstractCollection<E>