| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 void retainAll(Iterable<Object> elements) { | 236 void retainAll(Iterable<Object> elements) { |
| 237 _setBase.retainAll(elements); | 237 _setBase.retainAll(elements); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void retainWhere(bool test(E element)) { | 240 void retainWhere(bool test(E element)) { |
| 241 _setBase.retainWhere(test); | 241 _setBase.retainWhere(test); |
| 242 } | 242 } |
| 243 | 243 |
| 244 Set<E> union(Set<E> other) => _setBase.union(other); | 244 Set<E> union(Set<E> other) => _setBase.union(other); |
| 245 |
| 246 Set<E> toSet() => new DelegatingSet<E>(_setBase.toSet()); |
| 247 |
| 248 Set<E> cloneEmpty() => new DelegatingSet<E>(_setBase.cloneEmpty()); |
| 245 } | 249 } |
| 246 | 250 |
| 247 /** | 251 /** |
| 248 * Creates a [Queue] that delegates all operations to a base queue. | 252 * Creates a [Queue] that delegates all operations to a base queue. |
| 249 * | 253 * |
| 250 * This class can be used hide non-`Queue` methods of a queue object, | 254 * This class can be used hide non-`Queue` methods of a queue object, |
| 251 * or it can be extended to add extra functionality on top of an existing | 255 * or it can be extended to add extra functionality on top of an existing |
| 252 * queue object. | 256 * queue object. |
| 253 */ | 257 */ |
| 254 class DelegatingQueue<E> extends DelegatingIterable<E> implements Queue<E> { | 258 class DelegatingQueue<E> extends DelegatingIterable<E> implements Queue<E> { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 int get length => _base.length; | 334 int get length => _base.length; |
| 331 | 335 |
| 332 V putIfAbsent(K key, V ifAbsent()) => _base.putIfAbsent(key, ifAbsent); | 336 V putIfAbsent(K key, V ifAbsent()) => _base.putIfAbsent(key, ifAbsent); |
| 333 | 337 |
| 334 V remove(Object key) => _base.remove(key); | 338 V remove(Object key) => _base.remove(key); |
| 335 | 339 |
| 336 Iterable<V> get values => _base.values; | 340 Iterable<V> get values => _base.values; |
| 337 | 341 |
| 338 String toString() => _base.toString(); | 342 String toString() => _base.toString(); |
| 339 } | 343 } |
| OLD | NEW |