| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * An collection of key-value pairs, from which you retrieve a value | 8 * An collection of key-value pairs, from which you retrieve a value |
| 9 * using its associated key. | 9 * using its associated key. |
| 10 * | 10 * |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * The keys must all be assignable to [K] and the values to [V]. | 44 * The keys must all be assignable to [K] and the values to [V]. |
| 45 * The [other] map itself can have any type. | 45 * The [other] map itself can have any type. |
| 46 * | 46 * |
| 47 * A `LinkedHashMap` requires the keys to implement compatible | 47 * A `LinkedHashMap` requires the keys to implement compatible |
| 48 * `operator==` and `hashCode`, and it allows null as a key. | 48 * `operator==` and `hashCode`, and it allows null as a key. |
| 49 * It iterates in key insertion order. | 49 * It iterates in key insertion order. |
| 50 */ | 50 */ |
| 51 factory Map.from(Map other) = LinkedHashMap<K, V>.from; | 51 factory Map.from(Map other) = LinkedHashMap<K, V>.from; |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Creates an unmodifiable hash based map containing the entries of [other]. |
| 55 * |
| 56 * The keys must all be assignable to [K] and the values to [V]. |
| 57 * The [other] map itself can have any type. |
| 58 * |
| 59 * The map requires the keys to implement compatible |
| 60 * `operator==` and `hashCode`, and it allows `null` as a key. |
| 61 * The created map iterates keys in a fixed order, |
| 62 * preserving the order provided by [other]. |
| 63 * |
| 64 * The resulting map behaves like the result of [Map.from], |
| 65 * except that the map returned by this constructor is not modifiable. |
| 66 */ |
| 67 external factory Map.unmodifiable(Map other); |
| 68 |
| 69 /** |
| 54 * Creates an identity map with the default implementation, [LinkedHashMap]. | 70 * Creates an identity map with the default implementation, [LinkedHashMap]. |
| 55 * | 71 * |
| 56 * The returned map allows `null` as a key. | 72 * The returned map allows `null` as a key. |
| 57 * It iterates in key insertion order. | 73 * It iterates in key insertion order. |
| 58 */ | 74 */ |
| 59 factory Map.identity() = LinkedHashMap<K, V>.identity; | 75 factory Map.identity() = LinkedHashMap<K, V>.identity; |
| 60 | 76 |
| 61 /** | 77 /** |
| 62 * Creates a Map instance in which the keys and values are computed from the | 78 * Creates a Map instance in which the keys and values are computed from the |
| 63 * [iterable]. | 79 * [iterable]. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 * Returns true if this map contains the given [value]. | 142 * Returns true if this map contains the given [value]. |
| 127 * | 143 * |
| 128 * Returns true if any of the values in the map are equal to `value` | 144 * Returns true if any of the values in the map are equal to `value` |
| 129 * according to the `==` operator. | 145 * according to the `==` operator. |
| 130 */ | 146 */ |
| 131 bool containsValue(Object value); | 147 bool containsValue(Object value); |
| 132 | 148 |
| 133 /** | 149 /** |
| 134 * Returns true if this map contains the given [key]. | 150 * Returns true if this map contains the given [key]. |
| 135 * | 151 * |
| 136 * Returns true if any of the keys in the map ar equal to `key` | 152 * Returns true if any of the keys in the map are equal to `key` |
| 137 * according to the equality used by the map. | 153 * according to the equality used by the map. |
| 138 */ | 154 */ |
| 139 bool containsKey(Object key); | 155 bool containsKey(Object key); |
| 140 | 156 |
| 141 /** | 157 /** |
| 142 * Returns the value for the given [key] or null if [key] is not in the map. | 158 * Returns the value for the given [key] or null if [key] is not in the map. |
| 143 * | 159 * |
| 144 * Some maps allows keys to have `null` as a value, | 160 * Some maps allows keys to have `null` as a value, |
| 145 * For those maps, a lookup using this operator does cannot be used to | 161 * For those maps, a lookup using this operator does cannot be used to |
| 146 * distinguish between a key not being in the map, and the key having a null | 162 * distinguish between a key not being in the map, and the key having a null |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 /** | 261 /** |
| 246 * Returns true if there is no key-value pair in the map. | 262 * Returns true if there is no key-value pair in the map. |
| 247 */ | 263 */ |
| 248 bool get isEmpty; | 264 bool get isEmpty; |
| 249 | 265 |
| 250 /** | 266 /** |
| 251 * Returns true if there is at least one key-value pair in the map. | 267 * Returns true if there is at least one key-value pair in the map. |
| 252 */ | 268 */ |
| 253 bool get isNotEmpty; | 269 bool get isNotEmpty; |
| 254 } | 270 } |
| OLD | NEW |