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

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

Issue 1360053003: Fix some cases where Map.containsValue did not accept Object as argument. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « sdk/lib/collection/maps.dart ('k') | tests/corelib/map_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 typedef bool _Predicate<T>(T value); 7 typedef bool _Predicate<T>(T value);
8 8
9 /** 9 /**
10 * A node in a splay tree. It holds the sorting key and the left 10 * A node in a splay tree. It holds the sorting key and the left
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); 318 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey);
319 Maps._fillMapWithIterables(map, keys, values); 319 Maps._fillMapWithIterables(map, keys, values);
320 return map; 320 return map;
321 } 321 }
322 322
323 int _compare(K key1, K key2) => _comparator(key1, key2); 323 int _compare(K key1, K key2) => _comparator(key1, key2);
324 324
325 SplayTreeMap._internal(); 325 SplayTreeMap._internal();
326 326
327 V operator [](Object key) { 327 V operator [](Object key) {
328 if (key == null) throw new ArgumentError(key);
329 if (!_validKey(key)) return null; 328 if (!_validKey(key)) return null;
330 if (_root != null) { 329 if (_root != null) {
331 int comp = _splay(key); 330 int comp = _splay(key);
332 if (comp == 0) { 331 if (comp == 0) {
333 _SplayTreeMapNode mapRoot = _root; 332 _SplayTreeMapNode mapRoot = _root;
334 return mapRoot.value; 333 return mapRoot.value;
335 } 334 }
336 } 335 }
337 return null; 336 return null;
338 } 337 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left) 828 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)
830 ..right = _copyNode(node.right); 829 ..right = _copyNode(node.right);
831 } 830 }
832 831
833 void clear() { _clear(); } 832 void clear() { _clear(); }
834 833
835 Set<E> toSet() => _clone(); 834 Set<E> toSet() => _clone();
836 835
837 String toString() => IterableBase.iterableToFullString(this, '{', '}'); 836 String toString() => IterableBase.iterableToFullString(this, '{', '}');
838 } 837 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/maps.dart ('k') | tests/corelib/map_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698