| 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, but null keys are not. | 7 * Null values are supported, but null keys are not. |
| 8 */ | 8 */ |
| 9 interface Map<K, V> default HashMapImplementation<K extends Hashable, V> { | 9 interface Map<K, V> default HashMapImplementation<K, V> { |
| 10 /** | 10 /** |
| 11 * Creates a map with the default implementation. | 11 * Creates a map with the default implementation. |
| 12 */ | 12 */ |
| 13 Map(); | 13 Map(); |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Creates a [Map] that contains all key value pairs of [other]. | 16 * Creates a [Map] that contains all key value pairs of [other]. |
| 17 */ | 17 */ |
| 18 Map.from(Map<K, V> other); | 18 Map.from(Map<K, V> other); |
| 19 | 19 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 * Returns true if there is no {key, value} pair in the map. | 85 * Returns true if there is no {key, value} pair in the map. |
| 86 */ | 86 */ |
| 87 bool isEmpty(); | 87 bool isEmpty(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Hash map version of the [Map] interface. A [HashMap] does not | 91 * Hash map version of the [Map] interface. A [HashMap] does not |
| 92 * 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] |
| 93 * and [getValues]. | 93 * and [getValues]. |
| 94 */ | 94 */ |
| 95 interface HashMap<K extends Hashable, V> extends Map<K, V> | 95 interface HashMap<K, V> extends Map<K, V> |
| 96 default HashMapImplementation<K extends Hashable, V> { | 96 default HashMapImplementation<K, V> { |
| 97 /** | 97 /** |
| 98 * Creates a map with the default implementation. | 98 * Creates a map with the default implementation. |
| 99 */ | 99 */ |
| 100 HashMap(); | 100 HashMap(); |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Creates a [HashMap] that contains all key value pairs of [other]. | 103 * Creates a [HashMap] that contains all key value pairs of [other]. |
| 104 */ | 104 */ |
| 105 HashMap.from(Map<K, V> other); | 105 HashMap.from(Map<K, V> other); |
| 106 } | 106 } |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * Hash map version of the [Map] interface that preserves insertion | 109 * Hash map version of the [Map] interface that preserves insertion |
| 110 * order. | 110 * order. |
| 111 */ | 111 */ |
| 112 interface LinkedHashMap<K extends Hashable, V> extends HashMap<K, V> | 112 interface LinkedHashMap<K, V> extends HashMap<K, V> |
| 113 default LinkedHashMapImplementation<K extends Hashable, V> { | 113 default LinkedHashMapImplementation<K, V> { |
| 114 /** | 114 /** |
| 115 * Creates a map with the default implementation. | 115 * Creates a map with the default implementation. |
| 116 */ | 116 */ |
| 117 LinkedHashMap(); | 117 LinkedHashMap(); |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. | 120 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. |
| 121 */ | 121 */ |
| 122 LinkedHashMap.from(Map<K, V> other); | 122 LinkedHashMap.from(Map<K, V> other); |
| 123 } | 123 } |
| OLD | NEW |