| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 * new LinkedHashMap(equals: identical, | 82 * new LinkedHashMap(equals: identical, |
| 83 * hashCode: identityHashCode) | 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 as Object/*=K*/] = v as Object/*=V*/; }); |
| 93 return result; | 93 return result; |
| 94 } | 94 } |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Creates a [LinkedHashMap] where the keys and values are computed from the | 97 * Creates a [LinkedHashMap] where the keys and values are computed from the |
| 98 * [iterable]. | 98 * [iterable]. |
| 99 * | 99 * |
| 100 * For each element of the [iterable] this constructor computes a key/value | 100 * For each element of the [iterable] this constructor computes a key/value |
| 101 * pair, by applying [key] and [value] respectively. | 101 * pair, by applying [key] and [value] respectively. |
| 102 * | 102 * |
| (...skipping 20 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 |