Class IndexedCollection Collection Methods IndexedCollection at: aKey ^ self at: aKey ifAbsent: [ smalltalk error: 'index to at: illegal' ] ] Methods IndexedCollection values ^ self binaryInject: List new into: [:s :i :x | s add: x ] ] Methods IndexedCollection indexOf: aBlock ^ self indexOf: aBlock ifAbsent: [ smalltalk error: 'index not found'] ] Methods IndexedCollection select: aBlock ^ self binaryInject: Dictionary new into: [:s :i :x | (aBlock value: x) ifTrue: [ s at: i put: x ]. s ] ] Methods IndexedCollection asDictionary ^ Dictionary new ; addAll: self ] Methods IndexedCollection do: aBlock self binaryDo: [:i :x | aBlock value: x ] ] Methods IndexedCollection keys ^ self binaryInject: Set new into: [:s :i :x | s add: i ] ] Methods IndexedCollection at: index ifAbsent: exceptionBlock ^ (self includesKey: index) ifTrue: [ self basicAt: index ] ifFalse: exceptionBlock ] Methods IndexedCollection indexOf: aBlock ifAbsent: exceptionBlock self binaryDo: [:i :x | (aBlock value: x) ifTrue: [ ^ i ] ]. ^ exceptionBlock value ] Methods IndexedCollection addAll: aCollection aCollection binaryDo: [:i :x | self at: i put: x ] ] Methods IndexedCollection asArray ^ Array new: self size ; addAll: self ] Methods IndexedCollection collect: aBlock ^ self binaryInject: Dictionary new into: [:s :i :x | s at: i put: (aBlock value: x). s] ] Methods IndexedCollection binaryInject: thisValue into: aBlock | last | last <- thisValue. self binaryDo: [:i :x | last <- aBlock value: last value: i value: x]. ^ last ]