Class AbstractSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
- Type Parameters:
E
- the type of elements maintained by this set
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
- Direct Known Subclasses:
ConcurrentSkipListSet
,CopyOnWriteArraySet
,EnumSet
,HashSet
,TreeSet
This class provides a skeletal implementation of the
Set
interface to minimize the effort required to implement this
interface.
The process of implementing a set by extending this class is identical
to that of implementing a Collection by extending AbstractCollection,
except that all of the methods and constructors in subclasses of this
class must obey the additional constraints imposed by the Set
interface (for instance, the add method must not permit addition of
multiple instances of an object to a set).
Note that this class does not override any of the implementations from
the AbstractCollection
class. It merely adds implementations
for equals
and hashCode
.
This class is a member of the Java Collections Framework.
- Since:
- 1.2
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified object with this set for equality.int
hashCode()
Returns the hash code value for this set.boolean
removeAll
(Collection<?> c) Removes from this set all of its elements that are contained in the specified collection (optional operation).Methods declared in class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, toArray, toArray, toString
Methods declared in class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods declared in interface java.util.Collection
parallelStream, removeIf, stream, toArray