# addall(::AbstractDict, ::AbstractDict)

**URL:** <https://discourse.julialang.org/t/addall-abstractdict-abstractdict/59722>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [April 21, 2021, 10:27am UTC](https://discourse.julialang.org/t/addall-abstractdict-abstractdict/59722 "2021-04-21T10:27:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Impressium](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/impressium/32/19575_2.png) [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Post date:** [April 21, 2021, 10:27am UTC](https://discourse.julialang.org/t/addall-abstractdict-abstractdict/59722/1 "2021-04-21T10:27:23Z")

</div>

Hey All 🙂

First of all. Is there a `addall(::AbstractDict, ::AbstractDict)` function? I didn’t find one.  
My work around was:

```julia
push!(copy_to_dict, copy_from_dict...)

```

But now the problem is that if `length(copy_from_dict) == 0` the code above throws an error.

```julia
julia> d = Dict()
Dict{Any, Any}()

julia> push!(d, Dict()...)
ERROR: MethodError: no method matching push!(::Dict{Any, Any})
Closest candidates are:
  push!(::AbstractDict, ::Pair) at abstractdict.jl:515
  push!(::AbstractDict, ::Pair, ::Pair) at abstractdict.jl:516
  push!(::AbstractDict, ::Pair, ::Pair, ::Pair...) at abstractdict.jl:517

```

Should I open an issue to add `push!(::AbstractDict)` and/or to add `addall!`

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [April 21, 2021, 10:38am UTC](https://discourse.julialang.org/t/addall-abstractdict-abstractdict/59722/2 "2021-04-21T10:38:16Z")

</div>

I think `merge!` already does this:

```julia
help?> merge!
search: merge! mergewith! merge mergewith MergeSort

  merge!(d::AbstractDict, others::AbstractDict...)

  Update collection with pairs from the other collections. See also merge.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> d1 = Dict(1 => 2, 3 => 4);

  julia> d2 = Dict(1 => 4, 4 => 5);

  julia> merge!(d1, d2);

  julia> d1
  Dict{Int64, Int64} with 3 entries:
    4 => 5
    3 => 4
    1 => 4

```
