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

Unified Diff: pkg/serialization/lib/src/serialization_helpers.dart

Issue 14246008: Allow Object when doing lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Forgot to upload before committing Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mdv_observe/lib/src/observable_map.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/lib/src/serialization_helpers.dart
diff --git a/pkg/serialization/lib/src/serialization_helpers.dart b/pkg/serialization/lib/src/serialization_helpers.dart
index 714315591d8ea1642e8f3c0fc1f901521a1a2dc4..87fe55c9ec91cdb829d572bc1abc0d472835d94a 100644
--- a/pkg/serialization/lib/src/serialization_helpers.dart
+++ b/pkg/serialization/lib/src/serialization_helpers.dart
@@ -190,7 +190,7 @@ class IdentityMap<K, V> implements Map<K, V> {
final List<K> keys = <K>[];
final List<V> values = <V>[];
- V operator [](K key) {
+ V operator [](Object key) {
var index = _indexOf(key);
return (index == -1) ? null : values[index];
}
@@ -216,7 +216,7 @@ class IdentityMap<K, V> implements Map<K, V> {
}
}
- int _indexOf(K key) {
+ int _indexOf(Object key) {
// Go backwards on the guess that we are most likely to access the most
// recently added.
// Make strings and primitives unique
@@ -228,14 +228,14 @@ class IdentityMap<K, V> implements Map<K, V> {
return -1;
}
- bool containsKey(K key) => _indexOf(key) != -1;
+ bool containsKey(Object key) => _indexOf(key) != -1;
void forEach(f(K key, V value)) {
for (var i = 0; i < keys.length; i++) {
f(keys[i], values[i]);
}
}
- V remove(K key) {
+ V remove(Object key) {
var index = _indexOf(key);
if (index == -1) return null;
keys.removeAt(index);
@@ -251,7 +251,7 @@ class IdentityMap<K, V> implements Map<K, V> {
bool get isNotEmpty => !isEmpty;
// Note that this is doing an equality comparison.
- bool containsValue(x) => values.contains(x);
+ bool containsValue(Object x) => values.contains(x);
void addAll(Map<K, V> other) {
other.forEach((K key, V value) {
« no previous file with comments | « pkg/mdv_observe/lib/src/observable_map.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698