| 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 14 matching lines...) Expand all Loading... |
| 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 | 34 |
| 35 String toString() => IterableMixinWorkaround.toStringIterable(this, '{', '}'); | 35 String toString() => _setToString(this); |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * An unordered hash-table based [Set] implementation. | 39 * An unordered hash-table based [Set] implementation. |
| 40 * | 40 * |
| 41 * The elements of a `HashSet` must have consistent equality | 41 * The elements of a `HashSet` must have consistent equality |
| 42 * and hashCode implementations. This means that the equals operation | 42 * and hashCode implementations. This means that the equals operation |
| 43 * must define a stable equivalence relation on the elements (reflexive, | 43 * must define a stable equivalence relation on the elements (reflexive, |
| 44 * anti-symmetric, transitive, and consistent over time), and that the hashCode | 44 * anti-symmetric, transitive, and consistent over time), and that the hashCode |
| 45 * must consistent with equality, so that the same for objects that are | 45 * 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 } | 97 } |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Provides an iterator that iterates over the elements of this set. | 100 * Provides an iterator that iterates over the elements of this set. |
| 101 * | 101 * |
| 102 * The order of iteration is unspecified, | 102 * The order of iteration is unspecified, |
| 103 * but consistent between changes to the set. | 103 * but consistent between changes to the set. |
| 104 */ | 104 */ |
| 105 Iterator<E> get iterator; | 105 Iterator<E> get iterator; |
| 106 } | 106 } |
| OLD | NEW |