#FEATURE by stefan
authorStefan Vogel <sv@exept.de>
Tue, 11 Sep 2018 18:36:14 +0200
changeset 23327 cfb5dc1be47f
parent 23326 b1abe05f0398
child 23328 f56dbcff5536
#FEATURE by stefan class: Collection added: #pairsAsDictionary comment/format in: #associationsAsDictionary
Collection.st
--- a/Collection.st	Tue Sep 11 18:24:30 2018 +0200
+++ b/Collection.st	Tue Sep 11 18:36:14 2018 +0200
@@ -361,10 +361,6 @@
 ! !
 
 
-
-
-
-
 !Collection methodsFor:'Compatibility-ANSI'!
 
 identityIncludes:anObject
@@ -2181,11 +2177,14 @@
     "return a new Dictionary with the receiver collection's elements,
      which must be associations"
 
-    ^  Dictionary withAssociations:self.
-
-    "
+    ^ Dictionary withAssociations:self.
+
+    "
+     { 'ten' -> 10 . 'twenty' -> 20 . 'thirty' -> 30 } asSet associationsAsDictionary 
      { 'ten' -> 10 . 'twenty' -> 20 . 'thirty' -> 30 } associationsAsDictionary 
     "
+
+    "Modified (comment): / 11-09-2018 / 12:24:30 / Stefan Vogel"
 !
 
 copyAs:collectionClass
@@ -2276,6 +2275,21 @@
     "Modified: 22.4.1996 / 13:00:56 / cg"
 !
 
+pairsAsDictionary
+    "return a new Dictionary with the receiver collection's elements,
+     each of which must be a SequenceableCollection with two elements"
+
+    ^ Dictionary withKeyValuePairs:self.
+
+    "
+     #( ('ten' 10) ('twenty' 20) ('thirty' 30)) asSet pairsAsDictionary 
+     #( ('ten' 10) ('twenty' 20) ('thirty' 30)) pairsAsDictionary 
+    "
+
+    "Created: / 11-09-2018 / 12:28:43 / Stefan Vogel"
+    "Modified (comment): / 11-09-2018 / 15:37:29 / Stefan Vogel"
+!
+
 readStream
     "return a stream for reading from the receiver"