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

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

Issue 24267023: Update implementations to use Object.identityHashCode for identity map/set (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Add tests. Fix few bugs now that it can run. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/collection/hash_map.dart ('k') | 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 /** Common parts of [HashSet] and [LinkedHashSet] implementations. */ 7 /** Common parts of [HashSet] and [LinkedHashSet] implementations. */
8 abstract class _HashSetBase<E> extends IterableBase<E> implements Set<E> { 8 abstract class _HashSetBase<E> extends IterableBase<E> implements Set<E> {
9 9
10 // Set. 10 // Set.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 * 103 *
104 * If [equals] is [identical], this creates an identity set. Any hashCode 104 * If [equals] is [identical], this creates an identity set. Any hashCode
105 * is compatible with [identical], and it applies to all objects, so 105 * is compatible with [identical], and it applies to all objects, so
106 * [hashCode] and [isValidKey] can safely be omitted. 106 * [hashCode] and [isValidKey] can safely be omitted.
107 */ 107 */
108 external factory HashSet({ bool equals(E e1, E e2), 108 external factory HashSet({ bool equals(E e1, E e2),
109 int hashCode(E e), 109 int hashCode(E e),
110 bool isValidKey(potentialKey) }); 110 bool isValidKey(potentialKey) });
111 111
112 /** 112 /**
113 * Creates an unordered identity-based set.
114 *
115 * Effectively a shorthand for:
116 *
117 * new HashSet(equals: identical, hashCode: identityHashCodeOf)
118 */
119 external factory HashSet.identity();
120
121 /**
113 * Create a hash set containing the elements of [iterable]. 122 * Create a hash set containing the elements of [iterable].
114 * 123 *
115 * Creates a hash set as by `new HashSet<E>()` and adds each element of 124 * Creates a hash set as by `new HashSet<E>()` and adds each element of
116 * `iterable` to this set in the order they are iterated. 125 * `iterable` to this set in the order they are iterated.
117 */ 126 */
118 factory HashSet.from(Iterable<E> iterable) { 127 factory HashSet.from(Iterable<E> iterable) {
119 return new HashSet<E>()..addAll(iterable); 128 return new HashSet<E>()..addAll(iterable);
120 } 129 }
121 } 130 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/hash_map.dart ('k') | sdk/lib/collection/linked_hash_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698