GeezerVison is showing docs.oracle.com — AbstractSet (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.util
Class AbstractSet<E>
-
-
Constructor Summary
Constructors
| Modifier |
Constructor |
Description |
protected |
AbstractSet() |
Sole constructor.
|
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
boolean |
equals(Object o) |
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 inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toString
-
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, spliterator, toArray, toArray
-
-
Method Detail
-
hashCode
public int hashCode()
Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set,
where the hash code of a null element is defined to be zero.
This ensures that s1.equals(s2) implies that
s1.hashCode()==s2.hashCode() for any two sets s1
and s2, as required by the general contract of
Object.hashCode().
This implementation iterates over the set, calling the
hashCode method on each element in the set, and adding up
the results.
- Specified by:
hashCode in interface Collection<E>
- Specified by:
hashCode in interface Set<E>
- Overrides:
hashCode in class Object
- Returns:
- the hash code value for this set
- See Also:
Object.equals(Object),
Set.equals(Object)
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|