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

Unified Diff: packages/quiver/lib/src/cache/map_cache.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/quiver/lib/src/cache/cache.dart ('k') | packages/quiver/lib/src/collection/bimap.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/quiver/lib/src/cache/map_cache.dart
diff --git a/packages/quiver/lib/src/cache/map_cache.dart b/packages/quiver/lib/src/cache/map_cache.dart
index 3544422e4ef2a773c9eb35fa994da619f0ef5ead..e2364785a4811bbdf3215238970b5a4ba295e867 100644
--- a/packages/quiver/lib/src/cache/map_cache.dart
+++ b/packages/quiver/lib/src/cache/map_cache.dart
@@ -14,21 +14,15 @@
part of quiver.cache;
-/**
- * A [Cache] that's backed by a [Map].
- */
+/// A [Cache] that's backed by a [Map].
class MapCache<K, V> implements Cache<K, V> {
final Map<K, V> _map;
- /**
- * Creates a new [MapCache], optionally using [map] as the backing [Map].
- */
+ /// Creates a new [MapCache], optionally using [map] as the backing [Map].
MapCache({Map<K, V> map}) : _map = map != null ? map : new HashMap<K, V>();
- /**
- * Creates a new [MapCache], using [LruMap] as the backing [Map].
- * Optionally specify [maximumSize].
- */
+ /// Creates a new [MapCache], using [LruMap] as the backing [Map].
+ /// Optionally specify [maximumSize].
factory MapCache.lru({int maximumSize}) {
return new MapCache<K, V>(map: new LruMap(maximumSize: maximumSize));
}
@@ -38,12 +32,12 @@ class MapCache<K, V> implements Cache<K, V> {
var valOrFuture = ifAbsent(key);
if (valOrFuture is Future) {
return valOrFuture.then((v) {
- _map[key] = v;
- return v;
+ _map[key] = v as V;
+ return v as V;
});
} else {
- _map[key] = valOrFuture;
- return new Future.value(valOrFuture);
+ _map[key] = valOrFuture as V;
+ return new Future<V>.value(valOrFuture);
}
}
return new Future.value(_map[key]);
« no previous file with comments | « packages/quiver/lib/src/cache/cache.dart ('k') | packages/quiver/lib/src/collection/bimap.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698