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]); |