From: Jean Privat Date: Tue, 20 Oct 2015 00:19:12 +0000 (-0400) Subject: core::hash_collection: simplify `enlarge` X-Git-Tag: v0.7.9~22^2~1 X-Git-Url: http://nitlanguage.org core::hash_collection: simplify `enlarge` Signed-off-by: Jean Privat --- diff --git a/lib/core/collection/hash_collection.nit b/lib/core/collection/hash_collection.nit index 7c9fc6a..890ecd9 100644 --- a/lib/core/collection/hash_collection.nit +++ b/lib/core/collection/hash_collection.nit @@ -165,7 +165,6 @@ private abstract class HashCollection[K] # Force a capacity fun enlarge(cap: Int) do - var old_cap = _capacity # get a new capacity if cap < _the_length + 1 then cap = _the_length + 1 if cap <= _capacity then return @@ -176,16 +175,6 @@ private abstract class HashCollection[K] var new_array = new NativeArray[nullable N](cap) _array = new_array - # clean the new array - var i = cap - 1 - while i >=0 do - new_array[i] = null - i -= 1 - end - - if _the_length == 0 then return - if _capacity <= old_cap then return - # Reput items in the array var node = _first_item while node != null do