| 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 IterableBase<E> implements Set<E> { | 8 abstract class _HashSetBase<E> extends IterableBase<E> implements Set<E> { |
| 9 | 9 |
| 10 // Set. | 10 // Set. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 List<E> toList({bool growable: true}) { | 53 List<E> toList({bool growable: true}) { |
| 54 List<E> result = growable ? (new List<E>()..length = this.length) | 54 List<E> result = growable ? (new List<E>()..length = this.length) |
| 55 : new List<E>(this.length); | 55 : new List<E>(this.length); |
| 56 int i = 0; | 56 int i = 0; |
| 57 for (E element in this) result[i++] = element; | 57 for (E element in this) result[i++] = element; |
| 58 return result; | 58 return result; |
| 59 } | 59 } |
| 60 | 60 |
| 61 Set<E> cloneEmpty() => _newSet(); |
| 62 |
| 61 Set<E> toSet() => _newSet()..addAll(this); | 63 Set<E> toSet() => _newSet()..addAll(this); |
| 62 | 64 |
| 63 String toString() => IterableMixinWorkaround.toStringIterable(this, '{', '}'); | 65 String toString() => IterableMixinWorkaround.toStringIterable(this, '{', '}'); |
| 64 } | 66 } |
| 65 | 67 |
| 66 /** | 68 /** |
| 67 * An unordered hash-table based [Set] implementation. | 69 * An unordered hash-table based [Set] implementation. |
| 68 * | 70 * |
| 69 * The elements of a `HashSet` must have consistent equality | 71 * The elements of a `HashSet` must have consistent equality |
| 70 * and hashCode implementations. This means that the equals operation | 72 * and hashCode implementations. This means that the equals operation |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 127 } |
| 126 | 128 |
| 127 /** | 129 /** |
| 128 * Provides an iterator that iterates over the elements of this set. | 130 * Provides an iterator that iterates over the elements of this set. |
| 129 * | 131 * |
| 130 * The order of iteration is unspecified, | 132 * The order of iteration is unspecified, |
| 131 * but consistent between changes to the set. | 133 * but consistent between changes to the set. |
| 132 */ | 134 */ |
| 133 Iterator<E> get iterator; | 135 Iterator<E> get iterator; |
| 134 } | 136 } |
| OLD | NEW |