| 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 /** | 5 /** |
| 6 * Delegating wrappers for [Iterable], [List], [Set], [Queue] and [Map]. | 6 * Delegating wrappers for [Iterable], [List], [Set], [Queue] and [Map]. |
| 7 * | 7 * |
| 8 * Also adds unmodifiable views for `Set` and `Map`, and a fixed length | 8 * Also adds unmodifiable views for `Set` and `Map`, and a fixed length |
| 9 * view for `List`. The unmodifable list view from `dart:collection` is exported | 9 * view for `List`. The unmodifable list view from `dart:collection` is exported |
| 10 * as well, just for completeness. | 10 * as well, just for completeness. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 void retainAll(Iterable<Object> elements) { | 248 void retainAll(Iterable<Object> elements) { |
| 249 _setBase.retainAll(elements); | 249 _setBase.retainAll(elements); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void retainWhere(bool test(E element)) { | 252 void retainWhere(bool test(E element)) { |
| 253 _setBase.retainWhere(test); | 253 _setBase.retainWhere(test); |
| 254 } | 254 } |
| 255 | 255 |
| 256 Set<E> union(Set<E> other) => _setBase.union(other); | 256 Set<E> union(Set<E> other) => _setBase.union(other); |
| 257 |
| 258 Set<E> toSet() => new DelegatingSet<E>(_setBase.toSet()); |
| 257 } | 259 } |
| 258 | 260 |
| 259 /** | 261 /** |
| 260 * Creates a [Queue] that delegates all operations to a base queue. | 262 * Creates a [Queue] that delegates all operations to a base queue. |
| 261 * | 263 * |
| 262 * This class can be used hide non-`Queue` methods of a queue object, | 264 * This class can be used hide non-`Queue` methods of a queue object, |
| 263 * or it can be extended to add extra functionality on top of an existing | 265 * or it can be extended to add extra functionality on top of an existing |
| 264 * queue object. | 266 * queue object. |
| 265 */ | 267 */ |
| 266 class DelegatingQueue<E> extends DelegatingIterable<E> implements Queue<E> { | 268 class DelegatingQueue<E> extends DelegatingIterable<E> implements Queue<E> { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 * Returns a new set which contains all the elements of [this] and [other]. | 560 * Returns a new set which contains all the elements of [this] and [other]. |
| 559 * | 561 * |
| 560 * That is, the returned set contains all the elements of this [Set] and all | 562 * That is, the returned set contains all the elements of this [Set] and all |
| 561 * the elements of [other]. | 563 * the elements of [other]. |
| 562 * | 564 * |
| 563 * Note that the returned set will use the default equality operation, which | 565 * Note that the returned set will use the default equality operation, which |
| 564 * may be different than the equality operation [this] uses. | 566 * may be different than the equality operation [this] uses. |
| 565 */ | 567 */ |
| 566 Set<V> union(Set<V> other) => toSet()..addAll(other); | 568 Set<V> union(Set<V> other) => toSet()..addAll(other); |
| 567 } | 569 } |
| OLD | NEW |