83
83
84
84
empty (d:: OrderedRobinDict{K,V} ) where {K,V} = OrderedRobinDict {K,V} ()
85
85
86
- length (d:: OrderedRobinDict ) = d. count
87
- isempty (d:: OrderedRobinDict ) = (length (d) == 0 )
86
+ length (d:: Union{RobinDict, OrderedRobinDict} ) = d. count
87
+ isempty (d:: Union{RobinDict, OrderedRobinDict} ) = (length (d) == 0 )
88
88
89
89
"""
90
90
empty!(collection) -> collection
123
123
124
124
function setindex! (h:: OrderedRobinDict{K, V} , v0, key0) where {K,V}
125
125
key = convert (K,key0)
126
- v = convert (V, v0)
126
+ v = convert (V, v0)
127
127
index = get (h. dict, key, - 2 )
128
128
129
129
if index < 0
@@ -212,10 +212,9 @@ OrderedRobinDict{String,Int64} with 4 entries:
212
212
get! (collection, key, default)
213
213
214
214
function get! (h:: OrderedRobinDict{K,V} , key0, default) where {K,V}
215
- key = convert (K,key0)
216
215
index = get (h. dict, key, - 2 )
217
216
index > 0 && return h. vals[index]
218
- v = convert (V, default)
217
+ v = convert (V, default)
219
218
setindex! (h, v, key)
220
219
return v
221
220
end
@@ -237,11 +236,10 @@ end
237
236
get! (f:: Function , collection, key)
238
237
239
238
function get! (default:: Base.Callable , h:: OrderedRobinDict{K,V} , key0) where {K,V}
240
- key = convert (K,key0)
241
239
index = get (h. dict, key, - 2 )
242
240
index > 0 && return @inbounds h. vals[index]
243
241
244
- v = convert (V, default ())
242
+ v = convert (V, default ())
245
243
setindex! (h, v, key)
246
244
return v
247
245
end
@@ -455,7 +453,7 @@ Base.@propagate_inbounds function iterate(h::OrderedRobinDict, i)
455
453
return (Pair (h. keys[index], h. vals[index]), index+ 1 )
456
454
end
457
455
458
- filter! (f, d:: OrderedRobinDict ) = Base. filter_in_one_pass! (f, d)
456
+ filter! (f, d:: Union{RobinDict, OrderedRobinDict} ) = Base. filter_in_one_pass! (f, d)
459
457
460
458
function merge (d:: OrderedRobinDict , others:: AbstractDict... )
461
459
K,V = _merge_kvtypes (d, others... )
0 commit comments