lib/more_collections: add `clean` to `HashMap[23]`
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 14 Feb 2015 19:29:02 +0000 (14:29 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 17 Feb 2015 21:14:14 +0000 (16:14 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/more_collections.nit

index 004cc24..f9b55af 100644 (file)
@@ -93,6 +93,9 @@ class HashMap2[K1, K2, V]
                if level2 == null then return
                level2.keys.remove(k2)
        end
+
+       # Remove all items
+       fun clear do level1.clear
 end
 
 # Simple way to store an `HashMap[K1, HashMap[K2, HashMap[K3, V]]]`
@@ -137,6 +140,9 @@ class HashMap3[K1, K2, K3, V]
                if level2 == null then return
                level2.remove_at(k2, k3)
        end
+
+       # Remove all items
+       fun clear do level1.clear
 end
 
 # A map with a default value.