#FEATURE by stefan
class: Collection
added: #pairsAsDictionary
comment/format in: #associationsAsDictionary
--- 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"