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 unordered collection of key-value pairs, | 8 * An unordered collection of key-value pairs, |
9 * from which you retrieve a value by using its associated key. | 9 * from which you retrieve a value by using its associated key. |
10 * | 10 * |
11 * Each key can occur at most once in a map. | 11 * Each key can occur at most once in a map. |
12 */ | 12 */ |
13 abstract class Map<K, V> { | 13 abstract class Map<K, V> { |
14 /** | 14 /** |
15 * Creates a Map instance with the default implementation. | 15 * Creates a Map instance with the default implementation. |
16 */ | 16 */ |
17 factory Map() = LinkedHashMap<K, V>; | 17 factory Map() = LinkedHashMap<K, V>; |
18 | 18 |
19 /** | 19 /** |
20 * Creates a Map instance that contains all key-value pairs of [other]. | 20 * Creates a Map instance that contains all key-value pairs of [other]. |
21 */ | 21 */ |
22 factory Map.from(Map<K, V> other) = LinkedHashMap<K, V>.from; | 22 factory Map.from(Map<K, V> other) = LinkedHashMap<K, V>.from; |
23 | 23 |
24 /** | 24 /** |
| 25 * Creates an identity map with the default implementation. |
| 26 */ |
| 27 factory Map.identity() = LinkedHashMap<K, V>.identity; |
| 28 |
| 29 /** |
25 * Creates a Map instance | 30 * Creates a Map instance |
26 * where the keys and values are computed from the [iterable]. | 31 * where the keys and values are computed from the [iterable]. |
27 * | 32 * |
28 * For each element of the [iterable] this constructor computes a key-value | 33 * For each element of the [iterable] this constructor computes a key-value |
29 * pair, by applying [key] and [value] respectively. | 34 * pair, by applying [key] and [value] respectively. |
30 * | 35 * |
31 * The keys computed by the source [iterable] | 36 * The keys computed by the source [iterable] |
32 * do not need to be unique. The last | 37 * do not need to be unique. The last |
33 * occurrence of a key will simply overwrite any previous value. | 38 * occurrence of a key will simply overwrite any previous value. |
34 * | 39 * |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 /** | 139 /** |
135 * Returns true if there is no {key, value} pair in the map. | 140 * Returns true if there is no {key, value} pair in the map. |
136 */ | 141 */ |
137 bool get isEmpty; | 142 bool get isEmpty; |
138 | 143 |
139 /** | 144 /** |
140 * Returns true if there is at least one {key, value} pair in the map. | 145 * Returns true if there is at least one {key, value} pair in the map. |
141 */ | 146 */ |
142 bool get isNotEmpty; | 147 bool get isNotEmpty; |
143 } | 148 } |
OLD | NEW |