Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 factory Map() = LinkedHashMap<K, V>; | 38 factory Map() = LinkedHashMap<K, V>; |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Creates a [LinkedHashMap] instance that contains all key-value pairs of | 41 * Creates a [LinkedHashMap] instance that contains all key-value pairs of |
| 42 * [other]. | 42 * [other]. |
| 43 * | 43 * |
| 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 the same order as [other]. | |
|
Ivan Posva
2015/05/11 18:16:54
This is a strong statement to make. If other itera
Anders Johnsen
2015/05/11 18:51:08
From https://api.dartlang.org/apidocs/channels/sta
Lasse Reichstein Nielsen
2015/05/13 11:18:59
This can probably still be written a little better
| |
| 62 * | |
| 63 * The resulting map behaves like the result of [Map.from], | |
| 64 * except that the map returned by this constructor diallows modification. | |
|
sra1
2015/05/07 19:24:42
disallows
or
does not allow
or
is not modifiable.
Lasse Reichstein Nielsen
2015/05/13 11:18:59
Done.
| |
| 65 */ | |
| 66 external factory Map.unmodifiable(Map other); | |
|
Søren Gjesse
2015/05/05 01:51:12
Is UnmodifiableMapView used that much that it warr
Lasse Reichstein Nielsen
2015/05/05 05:09:40
This constructor, like List.unmodifable, is intend
| |
| 67 | |
| 68 /** | |
| 54 * Creates an identity map with the default implementation, [LinkedHashMap]. | 69 * Creates an identity map with the default implementation, [LinkedHashMap]. |
| 55 * | 70 * |
| 56 * The returned map allows `null` as a key. | 71 * The returned map allows `null` as a key. |
| 57 * It iterates in key insertion order. | 72 * It iterates in key insertion order. |
| 58 */ | 73 */ |
| 59 factory Map.identity() = LinkedHashMap<K, V>.identity; | 74 factory Map.identity() = LinkedHashMap<K, V>.identity; |
| 60 | 75 |
| 61 /** | 76 /** |
| 62 * Creates a Map instance in which the keys and values are computed from the | 77 * Creates a Map instance in which the keys and values are computed from the |
| 63 * [iterable]. | 78 * [iterable]. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 /** | 260 /** |
| 246 * Returns true if there is no key-value pair in the map. | 261 * Returns true if there is no key-value pair in the map. |
| 247 */ | 262 */ |
| 248 bool get isEmpty; | 263 bool get isEmpty; |
| 249 | 264 |
| 250 /** | 265 /** |
| 251 * Returns true if there is at least one key-value pair in the map. | 266 * Returns true if there is at least one key-value pair in the map. |
| 252 */ | 267 */ |
| 253 bool get isNotEmpty; | 268 bool get isNotEmpty; |
| 254 } | 269 } |
| OLD | NEW |