| 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 * |
| 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 |
| 10 * as well, just for completeness. |
| 7 */ | 11 */ |
| 8 library dart.collection_helper.wrappers; | 12 library dart.collection_helpers.wrappers; |
| 9 | 13 |
| 10 import "dart:collection"; | 14 import "dart:collection"; |
| 11 import "dart:math" show Random; | 15 import "dart:math" show Random; |
| 12 | 16 |
| 17 export "dart:collection" show UnmodifiableListView; |
| 18 |
| 19 part "unmodifiable_wrappers.dart"; |
| 20 |
| 13 /** | 21 /** |
| 14 * Creates an [Iterable] that delegates all operations to a base iterable. | 22 * Creates an [Iterable] that delegates all operations to a base iterable. |
| 15 * | 23 * |
| 16 * This class can be used hide non-`Iterable` methods of an iterable object, | 24 * This class can be used hide non-`Iterable` methods of an iterable object, |
| 17 * or it can be extended to add extra functionality on top of an existing | 25 * or it can be extended to add extra functionality on top of an existing |
| 18 * iterable object. | 26 * iterable object. |
| 19 */ | 27 */ |
| 20 class DelegatingIterable<E> implements Iterable<E> { | 28 class DelegatingIterable<E> implements Iterable<E> { |
| 21 Iterable<E> _base; | 29 Iterable<E> _base; |
| 22 | 30 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 Iterable<K> get keys => _base.keys; | 321 Iterable<K> get keys => _base.keys; |
| 314 | 322 |
| 315 int get length => _base.length; | 323 int get length => _base.length; |
| 316 | 324 |
| 317 V putIfAbsent(K key, V ifAbsent()) => _base.putIfAbsent(key, ifAbsent); | 325 V putIfAbsent(K key, V ifAbsent()) => _base.putIfAbsent(key, ifAbsent); |
| 318 | 326 |
| 319 V remove(Object key) => _base.remove(key); | 327 V remove(Object key) => _base.remove(key); |
| 320 | 328 |
| 321 Iterable<V> get values => _base.values; | 329 Iterable<V> get values => _base.values; |
| 322 } | 330 } |
| OLD | NEW |