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

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

Issue 2002593002: Fix documentation for identity sets/maps. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/linked_hash_map.dart » ('j') | no next file with comments »
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 */ 85 */
86 external factory HashMap({bool equals(K key1, K key2), 86 external factory HashMap({bool equals(K key1, K key2),
87 int hashCode(K key), 87 int hashCode(K key),
88 bool isValidKey(potentialKey)}); 88 bool isValidKey(potentialKey)});
89 89
90 /** 90 /**
91 * Creates an unordered identity-based map. 91 * Creates an unordered identity-based map.
92 * 92 *
93 * Effectively a shorthand for: 93 * Effectively a shorthand for:
94 * 94 *
95 * new HashMap(equals: identical, 95 * new HashMap<K, V>(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 as Object/*=K*/] = v as Object/*=V*/; }); 105 other.forEach((k, v) { result[k as Object/*=K*/] = v as Object/*=V*/; });
106 return result; 106 return result;
(...skipping 29 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/linked_hash_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698