| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 7 /** |
| 8 * Base class for implementing a [Map]. | 8 * Base class for implementing a [Map]. |
| 9 * | 9 * |
| 10 * This class has a basic implementation of all but five of the members of | 10 * This class has a basic implementation of all but five of the members of |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 * | 207 * |
| 208 * A wrapper around a `Map` that forwards all members to the map provided in | 208 * A wrapper around a `Map` that forwards all members to the map provided in |
| 209 * the constructor, except for operations that modify the map. | 209 * the constructor, except for operations that modify the map. |
| 210 * Modifying operations throw instead. | 210 * Modifying operations throw instead. |
| 211 */ | 211 */ |
| 212 class UnmodifiableMapView<K, V> = | 212 class UnmodifiableMapView<K, V> = |
| 213 MapView<K, V> with _UnmodifiableMapMixin<K, V>; | 213 MapView<K, V> with _UnmodifiableMapMixin<K, V>; |
| 214 | 214 |
| 215 /** | 215 /** |
| 216 * Helper class which implements complex [Map] operations | 216 * Helper class which implements complex [Map] operations |
| 217 * in term of basic ones ([Map.keys], [Map.operator []], | 217 * in term of basic ones ([Map.keys], [Map.[]], |
| 218 * [Map.operator []=] and [Map.remove].) Not all methods are | 218 * [Map.[]=] and [Map.remove].) Not all methods are |
| 219 * necessary to implement each particular operation. | 219 * necessary to implement each particular operation. |
| 220 */ | 220 */ |
| 221 class Maps { | 221 class Maps { |
| 222 static bool containsValue(Map map, Object value) { | 222 static bool containsValue(Map map, Object value) { |
| 223 for (final v in map.values) { | 223 for (final v in map.values) { |
| 224 if (v == value) { | 224 if (v == value) { |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 return false; | 228 return false; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 map[keyIterator.current] = valueIterator.current; | 345 map[keyIterator.current] = valueIterator.current; |
| 346 hasNextKey = keyIterator.moveNext(); | 346 hasNextKey = keyIterator.moveNext(); |
| 347 hasNextValue = valueIterator.moveNext(); | 347 hasNextValue = valueIterator.moveNext(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 if (hasNextKey || hasNextValue) { | 350 if (hasNextKey || hasNextValue) { |
| 351 throw new ArgumentError("Iterables do not have same length."); | 351 throw new ArgumentError("Iterables do not have same length."); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 } | 354 } |
| OLD | NEW |