   @doc since: "1.13.0"
   @spec filter(map, ({key, value} -> as_boolean(term))) :: map
   def filter(map, fun) when is_map(map) and is_function(fun, 1) do
-    iter = iterator(map)
-    next = next(iter)
+    iter = :maps.iterator(map)
+    next = :maps.next(iter)
     :maps.from_list(do_filter(next, fun))
   end
 

  @doc since: "1.13.0"
  @spec map(map, ({key, value} -> value)) :: map
  def map(map, fun) when is_map(map) and is_function(fun, 1) do
    iter = iterator(map)
    next = next(iter)
    :maps.from_list(do_map(next, fun))
  end



  defp do_reject({key, value, iter}, fun) do
    if fun.({key, value}) do
      do_reject(:maps.next(iter), fun)
    else
      [{key, value} | do_reject(:maps.next(iter), fun)]
    end
  end

