--- a/Dictionary.st Fri Aug 28 12:38:51 2009 +0100
+++ b/Dictionary.st Sat Oct 24 16:48:19 2009 +0100
@@ -1190,15 +1190,40 @@
!Dictionary methodsFor:'copying'!
-, anotherDictionary
- "return a new dictionary containing a merged set of associations"
+, anotherDictionaryOrAssociation
+ "return a new dictionary containing a merged set of associations.
+ If anotherDictionaryOrAssociation includes any of the receiver's keys,
+ the value from anotherDictionaryOrAssociation will be placed into the
+ returned result."
|newDictionary|
- newDictionary := self species new.
- self keysAndValuesDo:[:key :value | newDictionary at:key put:value ].
- anotherDictionary keysAndValuesDo:[:key :value | newDictionary at:key put:value ].
+ newDictionary := self copy.
+ newDictionary declareAllFrom:anotherDictionaryOrAssociation.
^ newDictionary
+
+ "
+ |d1 d2|
+
+ d1 := Dictionary new.
+ d1 at:#a put:'aaa'.
+ d1 at:#b put:'bbb'.
+
+ d2 := Dictionary new.
+ d2 at:#b put:'bbbb'.
+ d2 at:#c put:'ccc'.
+
+ d1 , d2
+ "
+ "
+ |d1 d2|
+
+ d1 := Dictionary new.
+ d1 at:#a put:'aaa'.
+ d1 at:#b put:'bbb'.
+ d2 := d1 , (#c -> 'ccc').
+ d2
+ "
!
postCopy
@@ -2019,7 +2044,8 @@
!Dictionary class methodsFor:'documentation'!
version
- ^ '$Id: Dictionary.st 10448 2009-06-14 16:10:51Z vranyj1 $'
+ ^ '$Id: Dictionary.st 10473 2009-10-24 15:48:19Z vranyj1 $'
! !
Dictionary initialize!
+