| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * This class is the public interface of a set. A set is a collection | 6 * This class is the public interface of a set. A set is a collection |
| 7 * without duplicates. | 7 * without duplicates. |
| 8 */ | 8 */ |
| 9 abstract class Set<E> extends Collection<E> { | 9 abstract class Set<E> extends Collection<E> { |
| 10 factory Set() => new _HashSetImpl<E>(); | 10 factory Set() => new _HashSetImpl<E>(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * Returns a new set which is the intersection between this set and | 58 * Returns a new set which is the intersection between this set and |
| 59 * the given collection. | 59 * the given collection. |
| 60 */ | 60 */ |
| 61 Set<E> intersection(Collection<E> other); | 61 Set<E> intersection(Collection<E> other); |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Removes all elements in the set. | 64 * Removes all elements in the set. |
| 65 */ | 65 */ |
| 66 void clear(); | 66 void clear(); |
| 67 | 67 |
| 68 /** |
| 69 * Returns an immutable view of [this]. |
| 70 * |
| 71 * The returned [Set] is backed by [this] but cannot change [this]. |
| 72 */ |
| 73 Set<E> get view; |
| 68 } | 74 } |
| 69 | 75 |
| 70 abstract class HashSet<E> extends Set<E> { | 76 abstract class HashSet<E> extends Set<E> { |
| 71 factory HashSet() => new _HashSetImpl<E>(); | 77 factory HashSet() => new _HashSetImpl<E>(); |
| 72 | 78 |
| 73 /** | 79 /** |
| 74 * Creates a [Set] that contains all elements of [other]. | 80 * Creates a [Set] that contains all elements of [other]. |
| 75 */ | 81 */ |
| 76 factory HashSet.from(Iterable<E> other) => new _HashSetImpl<E>.from(other); | 82 factory HashSet.from(Iterable<E> other) => new _HashSetImpl<E>.from(other); |
| 77 } | 83 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 244 } |
| 239 | 245 |
| 240 // The entries in the set. May contain null or the sentinel value. | 246 // The entries in the set. May contain null or the sentinel value. |
| 241 List<E> _entries; | 247 List<E> _entries; |
| 242 | 248 |
| 243 // The next valid index in [_entries] or the length of [entries_]. | 249 // The next valid index in [_entries] or the length of [entries_]. |
| 244 // If it is the length of [_entries], calling [hasNext] on the | 250 // If it is the length of [_entries], calling [hasNext] on the |
| 245 // iterator will return false. | 251 // iterator will return false. |
| 246 int _nextValidIndex; | 252 int _nextValidIndex; |
| 247 } | 253 } |
| OLD | NEW |