[Pkg] The Trunk: Collections-eem.603.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Feb 3 20:07:17 UTC 2015


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.603.mcz

==================== Summary ====================

Name: Collections-eem.603
Author: eem
Time: 3 February 2015, 12:06:59.618 pm
UUID: 6521c82f-d8de-4c07-a754-3bc3a8667746
Ancestors: Collections-mt.602

Three fewer uses of isKindOf:

=============== Diff against Collections-mt.602 ===============

Item was changed:
  ----- Method: Dictionary>>= (in category 'comparing') -----
  = aDictionary
  	"Two dictionaries are equal if
  	 (a) they are the same 'kind' of thing.
  	 (b) they have the same set of keys.
  	 (c) for each (common) key, they have the same value"
  
  	self == aDictionary ifTrue: [ ^ true ].
+ 	aDictionary isDictionary ifFalse: [^false].
- 	(aDictionary isKindOf: Dictionary) ifFalse: [^false].
  	self size = aDictionary size ifFalse: [^false].
  	self associationsDo: [:assoc|
  		(aDictionary at: assoc key ifAbsent: [^false]) = assoc value
  			ifFalse: [^false]].
  	^true
  
  !

Item was changed:
  ----- Method: SequenceableCollection>>hasEqualElements: (in category 'comparing') -----
  hasEqualElements: otherCollection
  	"Answer whether the receiver's size is the same as otherCollection's
  	size, and each of the receiver's elements equal the corresponding 
  	element of otherCollection.
  	This should probably replace the current definition of #= ."
  
  	| size |
+ 	otherCollection isSequenceable ifFalse: [^ false].
- 	(otherCollection isKindOf: SequenceableCollection) ifFalse: [^ false].
  	(size := self size) = otherCollection size ifFalse: [^ false].
  	1 to: size do:
  		[:index |
  		(self at: index) = (otherCollection at: index) ifFalse: [^ false]].
  	^ true!

Item was changed:
  ----- Method: String>>subStrings: (in category 'converting') -----
  subStrings: separators 
  	"Answer an array containing the substrings in the receiver separated 
  	by the elements of separators."
  	| char result sourceStream subString |
  	#Collectn.
  	"Changed 2000/04/08 For ANSI <readableString> protocol."
+ 	(separators isString or:[separators allSatisfy: [:element | element isCharacter]]) ifFalse:
+ 		[^ self error: 'separators must be Characters.'].
- 	(separators isString or:[separators allSatisfy: [:element | element isKindOf: Character]])
- 		ifFalse: [^ self error: 'separators must be Characters.'].
  	sourceStream := ReadStream on: self.
  	result := OrderedCollection new.
  	subString := String new.
  	[sourceStream atEnd]
  		whileFalse: 
  			[char := sourceStream next.
  			(separators includes: char)
  				ifTrue: [subString notEmpty
  						ifTrue: 
  							[result add: subString copy.
  							subString := String new]]
  				ifFalse: [subString := subString , (String with: char)]].
  	subString notEmpty ifTrue: [result add: subString copy].
  	^ result asArray!



More information about the Packages mailing list