public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E>
Collection,
AbstractCollection,
Set,
HashSet,
TreeSet,
LinkedHashSet| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSet()
The main constructor, for use by subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Tests whether the given object is equal to this Set.
|
int |
hashCode()
Returns a hash code for this Set.
|
boolean |
removeAll(Collection<?> c)
Removes from this set all elements in the given collection (optional
operation).
|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toStringprotected AbstractSet()
public boolean equals(Object o)
equals in interface Collection<E>equals in interface Set<E>equals in class Objecto - the Object to be tested for equality with this SetObject.hashCode()public int hashCode()
hashCode in interface Collection<E>hashCode in interface Set<E>hashCode in class ObjectObject.equals(Object),
System.identityHashCode(Object)public boolean removeAll(Collection<?> c)
size() to determine
the smaller collection. Then, if this set is smaller, it iterates
over the set, calling Iterator.remove if the collection contains
the element. If this set is larger, it iterates over the collection,
calling Set.remove for all elements in the collection. Note that
this operation will fail if a remove methods is not supported.removeAll in interface Collection<E>removeAll in interface Set<E>removeAll in class AbstractCollection<E>c - the collection of elements to removeUnsupportedOperationException - if remove is not supportedNullPointerException - if the collection is nullAbstractCollection.remove(Object),
Collection.contains(Object),
Iterator.remove()