| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 action(key, this[key]); | 53 action(key, this[key]); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void addAll(Map<K, V> other) { | 57 void addAll(Map<K, V> other) { |
| 58 for (K key in other.keys) { | 58 for (K key in other.keys) { |
| 59 this[key] = other[key]; | 59 this[key] = other[key]; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool containsValue(V value) { | 63 bool containsValue(Object value) { |
| 64 for (K key in keys) { | 64 for (K key in keys) { |
| 65 if (this[key] == value) return true; | 65 if (this[key] == value) return true; |
| 66 } | 66 } |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 V putIfAbsent(K key, V ifAbsent()) { | 70 V putIfAbsent(K key, V ifAbsent()) { |
| 71 if (keys.contains(key)) { | 71 if (keys.contains(key)) { |
| 72 return this[key]; | 72 return this[key]; |
| 73 } | 73 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 map[keyIterator.current] = valueIterator.current; | 344 map[keyIterator.current] = valueIterator.current; |
| 345 hasNextKey = keyIterator.moveNext(); | 345 hasNextKey = keyIterator.moveNext(); |
| 346 hasNextValue = valueIterator.moveNext(); | 346 hasNextValue = valueIterator.moveNext(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 if (hasNextKey || hasNextValue) { | 349 if (hasNextKey || hasNextValue) { |
| 350 throw new ArgumentError("Iterables do not have same length."); | 350 throw new ArgumentError("Iterables do not have same length."); |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| OLD | NEW |