Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: sdk/lib/collection/hash_map.dart

Issue 1937103002: Make dart:collection strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sdk/lib/collection/hash_set.dart » ('j') | sdk/lib/collection/queue.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** Default function for equality comparison in customized HashMaps */ 7 /** Default function for equality comparison in customized HashMaps */
8 bool _defaultEquals(a, b) => a == b; 8 bool _defaultEquals(a, b) => a == b;
9 /** Default function for hash-code computation in customized HashMaps */ 9 /** Default function for hash-code computation in customized HashMaps */
10 int _defaultHashCode(a) => a.hashCode; 10 int _defaultHashCode(a) => a.hashCode;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * new HashMap(equals: identical, 95 * new HashMap(equals: identical,
96 * hashCode: identityHashCode) 96 * hashCode: identityHashCode)
97 */ 97 */
98 external factory HashMap.identity(); 98 external factory HashMap.identity();
99 99
100 /** 100 /**
101 * Creates a [HashMap] that contains all key/value pairs of [other]. 101 * Creates a [HashMap] that contains all key/value pairs of [other].
102 */ 102 */
103 factory HashMap.from(Map other) { 103 factory HashMap.from(Map other) {
104 HashMap<K, V> result = new HashMap<K, V>(); 104 HashMap<K, V> result = new HashMap<K, V>();
105 other.forEach((k, v) { result[k] = v; }); 105 other.forEach((k, v) { result[k as Object/*=K*/] = v as Object/*=V*/; });
106 return result; 106 return result;
107 } 107 }
108 108
109 /** 109 /**
110 * Creates a [HashMap] where the keys and values are computed from the 110 * Creates a [HashMap] where the keys and values are computed from the
111 * [iterable]. 111 * [iterable].
112 * 112 *
113 * For each element of the [iterable] this constructor computes a key/value 113 * For each element of the [iterable] this constructor computes a key/value
114 * pair, by applying [key] and [value] respectively. 114 * pair, by applying [key] and [value] respectively.
115 * 115 *
(...skipping 20 matching lines...) Expand all
136 * overwrites the previous value. 136 * overwrites the previous value.
137 * 137 *
138 * It is an error if the two [Iterable]s don't have the same length. 138 * It is an error if the two [Iterable]s don't have the same length.
139 */ 139 */
140 factory HashMap.fromIterables(Iterable<K> keys, Iterable<V> values) { 140 factory HashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
141 HashMap<K, V> map = new HashMap<K, V>(); 141 HashMap<K, V> map = new HashMap<K, V>();
142 Maps._fillMapWithIterables(map, keys, values); 142 Maps._fillMapWithIterables(map, keys, values);
143 return map; 143 return map;
144 } 144 }
145 } 145 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/collection/hash_set.dart » ('j') | sdk/lib/collection/queue.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698