Chromium Code Reviews| Index: sdk/lib/collection/splay_tree.dart |
| diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart |
| index 20cc84cd168512b1538cc332a1638c3e739862c7..84e61e10d4386e01a8e85514a643374b22ad59d9 100644 |
| --- a/sdk/lib/collection/splay_tree.dart |
| +++ b/sdk/lib/collection/splay_tree.dart |
| @@ -255,8 +255,9 @@ class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> { |
| SplayTreeMap._internal(); |
| - V operator [](K key) { |
| + V operator [](Object key) { |
| if (key == null) throw new ArgumentError(key); |
| + if (key is! K) return null; |
|
Lasse Reichstein Nielsen
2013/06/18 14:13:08
Per earlier discussion, could we keep this as "K"?
floitsch
2013/06/20 15:52:50
As discussed in person: leaving as is.
|
| if (_root != null) { |
| int comp = _splay(key); |
| if (comp == 0) { |
| @@ -337,11 +338,11 @@ class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> { |
| _clear(); |
| } |
| - bool containsKey(K key) { |
| - return _splay(key) == 0; |
| + bool containsKey(Object key) { |
| + return key is K && _splay(key) == 0; |
| } |
| - bool containsValue(V value) { |
| + bool containsValue(Object value) { |
| bool found = false; |
| int initialSplayCount = _splayCount; |
| bool visit(_SplayTreeMapNode node) { |