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 /** | 5 /** |
6 * A [Map] is an associative container, mapping a key to a value. | 6 * A [Map] is an associative container, mapping a key to a value. |
7 * Null values are supported. | 7 * Null values are supported. |
8 */ | 8 */ |
9 interface Map<K, V> factory HashMapImplementation/*<K extends Hashable, V>*/ { | 9 interface Map<K, V> default HashMapImplementation<K extends Hashable, V> { |
10 // See issue 417. Works in the vm, fails in dartc and frog. | |
11 | |
12 /** | 10 /** |
13 * Creates a map with the default implementation. | 11 * Creates a map with the default implementation. |
14 */ | 12 */ |
15 Map(); | 13 Map(); |
16 | 14 |
17 /** | 15 /** |
18 * Creates a [Map] that contains all key value pairs of [other]. | 16 * Creates a [Map] that contains all key value pairs of [other]. |
19 */ | 17 */ |
20 Map.from(Map<K, V> other); | 18 Map.from(Map<K, V> other); |
21 | 19 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 */ | 86 */ |
89 bool isEmpty(); | 87 bool isEmpty(); |
90 } | 88 } |
91 | 89 |
92 /** | 90 /** |
93 * Hash map version of the [Map] interface. A [HashMap] does not | 91 * Hash map version of the [Map] interface. A [HashMap] does not |
94 * provide any guarantees on the order of keys and values in [getKeys] | 92 * provide any guarantees on the order of keys and values in [getKeys] |
95 * and [getValues]. | 93 * and [getValues]. |
96 */ | 94 */ |
97 interface HashMap<K extends Hashable, V> extends Map<K, V> | 95 interface HashMap<K extends Hashable, V> extends Map<K, V> |
98 factory HashMapImplementation { | 96 default HashMapImplementation<K extends Hashable, V> { |
99 // See issue 417. Works in the vm, fails in dartc and frog. | |
100 | |
101 /** | 97 /** |
102 * Creates a map with the default implementation. | 98 * Creates a map with the default implementation. |
103 */ | 99 */ |
104 HashMap(); | 100 HashMap(); |
105 | 101 |
106 /** | 102 /** |
107 * Creates a [HashMap] that contains all key value pairs of [other]. | 103 * Creates a [HashMap] that contains all key value pairs of [other]. |
108 */ | 104 */ |
109 HashMap.from(Map<K, V> other); | 105 HashMap.from(Map<K, V> other); |
110 } | 106 } |
111 | 107 |
112 /** | 108 /** |
113 * Hash map version of the [Map] interface that preserves insertion | 109 * Hash map version of the [Map] interface that preserves insertion |
114 * order. | 110 * order. |
115 */ | 111 */ |
116 interface LinkedHashMap<K extends Hashable, V> extends HashMap<K, V> | 112 interface LinkedHashMap<K extends Hashable, V> extends HashMap<K, V> |
117 factory LinkedHashMapImplementation { | 113 default LinkedHashMapImplementation<K extends Hashable, V> { |
118 // See issue 417. Works in the vm, fails in dartc and frog. | |
119 | |
120 /** | 114 /** |
121 * Creates a map with the default implementation. | 115 * Creates a map with the default implementation. |
122 */ | 116 */ |
123 LinkedHashMap(); | 117 LinkedHashMap(); |
124 | 118 |
125 /** | 119 /** |
126 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. | 120 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. |
127 */ | 121 */ |
128 LinkedHashMap.from(Map<K, V> other); | 122 LinkedHashMap.from(Map<K, V> other); |
129 } | 123 } |
OLD | NEW |