From: Jean Privat Date: Fri, 6 Mar 2015 04:07:54 +0000 (+0700) Subject: lib/map: make concrete `Map.keys` and `Map.values` lazy X-Git-Tag: v0.7.3~39^2 X-Git-Url: http://nitlanguage.org lib/map: make concrete `Map.keys` and `Map.values` lazy Signed-off-by: Jean Privat --- diff --git a/lib/standard/collection/array.nit b/lib/standard/collection/array.nit index 1fb8581..253dd9e 100644 --- a/lib/standard/collection/array.nit +++ b/lib/standard/collection/array.nit @@ -618,8 +618,8 @@ class ArrayMap[K, E] end end - redef var keys: RemovableCollection[K] = new ArrayMapKeys[K, E](self) - redef var values: RemovableCollection[E] = new ArrayMapValues[K, E](self) + redef var keys: RemovableCollection[K] = new ArrayMapKeys[K, E](self) is lazy + redef var values: RemovableCollection[E] = new ArrayMapValues[K, E](self) is lazy # O(1) redef fun length do return _items.length diff --git a/lib/standard/collection/hash_collection.nit b/lib/standard/collection/hash_collection.nit index cdc7906..e5ff507 100644 --- a/lib/standard/collection/hash_collection.nit +++ b/lib/standard/collection/hash_collection.nit @@ -272,8 +272,8 @@ class HashMap[K, V] enlarge(0) end - redef var keys: RemovableCollection[K] = new HashMapKeys[K, V](self) - redef var values: RemovableCollection[V] = new HashMapValues[K, V](self) + redef var keys: RemovableCollection[K] = new HashMapKeys[K, V](self) is lazy + redef var values: RemovableCollection[V] = new HashMapValues[K, V](self) is lazy redef fun has_key(k) do return node_at(k) != null end