|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractSet
public abstract class AbstractSet
An abstract implementation of Set to make it easier to create your own implementations. In order to create a Set, subclass AbstractSet and implement the same methods that are required for AbstractCollection (although these methods must of course meet the requirements that Set puts on them - specifically, no element may be in the set more than once). This class simply provides implementations of equals() and hashCode() to fulfil the requirements placed on them by the Set interface.
Collection,
AbstractCollection,
Set,
HashSet,
TreeSet,
LinkedHashSet| Constructor Summary | |
|---|---|
protected |
AbstractSet()
The main constructor, for use by subclasses. |
| Method Summary | |
|---|---|
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). |
| Methods inherited from class java.util.AbstractCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray |
| Constructor Detail |
|---|
protected AbstractSet()
| Method Detail |
|---|
public boolean equals(Object o)
equals in interface Collectionequals in interface Setequals in class Objecto - the Object to be tested for equality with this Set
Object.hashCode()public int hashCode()
hashCode in interface CollectionhashCode in interface SethashCode 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 CollectionremoveAll in interface SetremoveAll in class AbstractCollectionc - the collection of elements to remove
UnsupportedOperationException - if remove is not supported
NullPointerException - if the collection is nullAbstractCollection.remove(Object),
Collection.contains(Object),
Iterator.remove()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||