public class ListSet
extends java.util.AbstractSet
implements java.util.Set, java.lang.Cloneable, java.io.Serializable
List transforming it into a
modifiable Set.| Modifier and Type | Field and Description |
|---|---|
protected java.util.List |
list
The List which will be used for element storage.
|
private static long |
serialVersionUID
The serialVersionUID
|
| Constructor and Description |
|---|
ListSet()
Construct a ListSet using an ArrayList for backing.
|
ListSet(java.util.Collection elements)
Construct a ListSet using an ArrayList for backing
and populated with the given elements.
|
ListSet(java.util.List list)
Construct a ListSet.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object obj)
Add an element to the set.
|
void |
clear()
Removes all of the elements from this set.
|
java.lang.Object |
clone()
Returns a shallow copy of this ListSet instance.
|
boolean |
contains(java.lang.Object obj)
Returns true if this set contains the specified element.
|
java.util.List |
getList() |
boolean |
isEmpty()
Returns true if this set contains no elements.
|
java.util.Iterator |
iterator()
Return an iteration over the elements in the set.
|
boolean |
remove(java.lang.Object obj)
Removes the given element from this set if it is present.
|
int |
size()
Return the size of the set.
|
addAll, containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitprivate static final long serialVersionUID
protected final java.util.List list
public ListSet(java.util.List list)
list - The List which will be used for element storage.java.lang.IllegalArgumentException - List is null or contains
duplicate entries.public ListSet()
public ListSet(java.util.Collection elements)
elements - The elements for the list.public java.util.List getList()
public int size()
size in interface java.util.Collectionsize in interface java.util.Setsize in class java.util.AbstractCollectionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Setiterator in class java.util.AbstractCollectionpublic boolean add(java.lang.Object obj)
add in interface java.util.Collectionadd in interface java.util.Setadd in class java.util.AbstractCollectionobj - Element to add to the set.public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.SetisEmpty in class java.util.AbstractCollectionpublic boolean contains(java.lang.Object obj)
contains in interface java.util.Collectioncontains in interface java.util.Setcontains in class java.util.AbstractCollectionobj - Element whose presence in this set is to be tested.public boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionremove in interface java.util.Setremove in class java.util.AbstractCollectionobj - Object to be removed from this set, if present.public void clear()
clear in interface java.util.Collectionclear in interface java.util.Setclear in class java.util.AbstractCollectionpublic java.lang.Object clone()
clone in class java.lang.Object