| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.collection; | 5 part of dart.collection; |
| 6 | 6 |
| 7 /** Common parts of [HashSet] and [LinkedHashSet] implementations. */ | 7 /** Common parts of [HashSet] and [LinkedHashSet] implementations. */ |
| 8 abstract class _HashSetBase<E> extends SetBase<E> { | 8 abstract class _HashSetBase<E> extends SetBase<E> { |
| 9 | 9 |
| 10 // The following two methods override the ones in SetBase. | 10 // The following two methods override the ones in SetBase. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 for (var element in this) { | 24 for (var element in this) { |
| 25 if (other.contains(element)) result.add(element); | 25 if (other.contains(element)) result.add(element); |
| 26 } | 26 } |
| 27 return result; | 27 return result; |
| 28 } | 28 } |
| 29 | 29 |
| 30 Set<E> _newSet(); | 30 Set<E> _newSet(); |
| 31 | 31 |
| 32 // Subclasses can optimize this further. | 32 // Subclasses can optimize this further. |
| 33 Set<E> toSet() => _newSet()..addAll(this); | 33 Set<E> toSet() => _newSet()..addAll(this); |
| 34 | |
| 35 String toString() => _setToString(this); | |
| 36 } | 34 } |
| 37 | 35 |
| 38 /** | 36 /** |
| 39 * An unordered hash-table based [Set] implementation. | 37 * An unordered hash-table based [Set] implementation. |
| 40 * | 38 * |
| 41 * The elements of a `HashSet` must have consistent equality | 39 * The elements of a `HashSet` must have consistent equality |
| 42 * and hashCode implementations. This means that the equals operation | 40 * and hashCode implementations. This means that the equals operation |
| 43 * must define a stable equivalence relation on the elements (reflexive, | 41 * must define a stable equivalence relation on the elements (reflexive, |
| 44 * anti-symmetric, transitive, and consistent over time), and that the hashCode | 42 * anti-symmetric, transitive, and consistent over time), and that the hashCode |
| 45 * must consistent with equality, so that the same for objects that are | 43 * must consistent with equality, so that the same for objects that are |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 95 } |
| 98 | 96 |
| 99 /** | 97 /** |
| 100 * Provides an iterator that iterates over the elements of this set. | 98 * Provides an iterator that iterates over the elements of this set. |
| 101 * | 99 * |
| 102 * The order of iteration is unspecified, | 100 * The order of iteration is unspecified, |
| 103 * but consistent between changes to the set. | 101 * but consistent between changes to the set. |
| 104 */ | 102 */ |
| 105 Iterator<E> get iterator; | 103 Iterator<E> get iterator; |
| 106 } | 104 } |
| OLD | NEW |