Now I can merge dictionaries in a nice way

testMergeWithNonOverlappingKeys
        "self run: #testMerge"
        
        | d d2 d3 |
        d := Dictionary new at: #x put: #(x y z) ; at: #y put: #(e f g ) ; at: 
#a put: #(a b c); yourself.
        d2 := Dictionary new at: #x put: #(x y z) ; at: #y put: #( h i j) ; 
yourself.
        d3 := d merge: d2 onKeyConflictDoValues: [ :aValue :anotherValue | 
(aValue, anotherValue) asSet asOrderedCollection ].
        
        self assert: (d3 at: #y) equals: #(e f g h i j).
        self assert: (d3 at: #a) equals: #(a b c ).
        self assert: (d3 at: #x) equals: #(x y z).
        

Reply via email to