OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.collection; | 5 part of dart.collection; |
6 | 6 |
7 /** | 7 /** |
8 * A hash-table based implementation of [Map]. | 8 * A hash-table based implementation of [Map]. |
9 * | 9 * |
10 * The insertion order of keys is remembered, | 10 * The insertion order of keys is remembered, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 external factory LinkedHashMap({bool equals(K key1, K key2), | 73 external factory LinkedHashMap({bool equals(K key1, K key2), |
74 int hashCode(K key), | 74 int hashCode(K key), |
75 bool isValidKey(potentialKey)}); | 75 bool isValidKey(potentialKey)}); |
76 | 76 |
77 /** | 77 /** |
78 * Creates an insertion-ordered identity-based map. | 78 * Creates an insertion-ordered identity-based map. |
79 * | 79 * |
80 * Effectively a shorthand for: | 80 * Effectively a shorthand for: |
81 * | 81 * |
82 * new LinkedHashMap(equals: identical, | 82 * new LinkedHashMap(equals: identical, |
83 * hashCode: identityHashCodeOf) | 83 * hashCode: identityHashCode) |
84 */ | 84 */ |
85 external factory LinkedHashMap.identity(); | 85 external factory LinkedHashMap.identity(); |
86 | 86 |
87 /** | 87 /** |
88 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. | 88 * Creates a [LinkedHashMap] that contains all key value pairs of [other]. |
89 */ | 89 */ |
90 factory LinkedHashMap.from(Map other) { | 90 factory LinkedHashMap.from(Map other) { |
91 LinkedHashMap<K, V> result = new LinkedHashMap<K, V>(); | 91 LinkedHashMap<K, V> result = new LinkedHashMap<K, V>(); |
92 other.forEach((k, v) { result[k] = v; }); | 92 other.forEach((k, v) { result[k] = v; }); |
93 return result; | 93 return result; |
(...skipping 29 matching lines...) Expand all Loading... |
123 * overwrites the previous value. | 123 * overwrites the previous value. |
124 * | 124 * |
125 * It is an error if the two [Iterable]s don't have the same length. | 125 * It is an error if the two [Iterable]s don't have the same length. |
126 */ | 126 */ |
127 factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values) { | 127 factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values) { |
128 LinkedHashMap<K, V> map = new LinkedHashMap<K, V>(); | 128 LinkedHashMap<K, V> map = new LinkedHashMap<K, V>(); |
129 Maps._fillMapWithIterables(map, keys, values); | 129 Maps._fillMapWithIterables(map, keys, values); |
130 return map; | 130 return map; |
131 } | 131 } |
132 } | 132 } |
OLD | NEW |