--- a/KeyedCollection.st Wed Oct 03 13:17:15 2018 +0200
+++ b/KeyedCollection.st Thu Oct 04 10:11:11 2018 +0200
@@ -178,6 +178,11 @@
|newDict sz "{ Class: SmallInteger }"|
sz := aSequenceableCollection size.
+ sz odd ifTrue:[
+ SubscriptOutOfBoundsError
+ raiseRequestWith:sz+1
+ errorString:('odd number of elements - subscript (' , (sz+1) printString , ') would be out of bounds')
+ ].
newDict := self new:sz.
1 to:sz by:2 do:[:i |
newDict at:(aSequenceableCollection at:i) put:(aSequenceableCollection at:i+1)
@@ -186,11 +191,12 @@
"
SmallDictionary withKeysAndValues:#('one' 1 'two' 2 'three' 3 'four' 4)
+ SmallDictionary withKeysAndValues:#('one' 1 'two' 2 'three' 3 'incomplete')
"
"Created: / 16-03-2017 / 12:13:27 / stefan"
"Modified: / 17-03-2017 / 11:32:42 / stefan"
- "Modified (comment): / 14-09-2018 / 17:51:24 / Stefan Vogel"
+ "Modified (comment): / 04-10-2018 / 10:09:46 / Stefan Vogel"
! !
!KeyedCollection class methodsFor:'queries'!