Let me just interject: for my own use-case, it would be OK that collect((1=>"a",2=>7) returns an object of type Vector{Pair{Int}} rather than Vector{Pair{Int,Any}} if only I knew of a documented (i.e., likely to persist in future versions of Julia) method to retrieve the types of the inner objects. This snippet illustrates the issue:
julia> u = Pair{Int,Any}[1=>"a",2=>7]
2-element Vector{Pair{Int64, Any}}:
1 => "a"
2 => 7
julia> eltype(u).parameters[1]
Int64
julia> u=collect((1=>"a",2=>7))
2-element Vector{Pair{Int64}}:
1 => "a"
2 => 7
julia> eltype(u).parameters[1]
ERROR: type UnionAll has no field parameters
Stacktrace:
[1] getproperty(x::Type, f::Symbol)
@ Base .\Base.jl:37
[2] top-level scope
@ REPL[39]:1