Returns the hash code for this set. Two set which are equal must return the same value. This implementation calculates the hash code by adding each element's hash code. @return the hash code of this set. @see #equals
()
| 73 | * @see #equals |
| 74 | */ |
| 75 | @Override |
| 76 | public int hashCode() { |
| 77 | int result = 0; |
| 78 | Iterator<?> it = iterator(); |
| 79 | while (it.hasNext()) { |
| 80 | Object next = it.next(); |
| 81 | result += next == null ? 0 : next.hashCode(); |
| 82 | } |
| 83 | return result; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Removes all occurrences in this collection which are contained in the |