counter: fix add all behavior
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 27 Feb 2017 19:37:38 +0000 (14:37 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 27 Feb 2017 19:37:38 +0000 (14:37 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/counter.nit

index ceb9896..e539bc5 100644 (file)
@@ -80,6 +80,12 @@ class Counter[E]
                map.clear
        end
 
+       redef fun add_all(other) do
+               for k, v in other do
+                       self[k] += v
+               end
+       end
+
        # Count one more occurrence of `e`
        fun inc(e: E)
        do