dont be confused when comparing against a non-collection.
--- a/SequenceableCollection.st Mon Aug 07 15:16:16 2006 +0200
+++ b/SequenceableCollection.st Mon Aug 07 15:49:01 2006 +0200
@@ -1193,16 +1193,22 @@
size := self size.
aCollectionSize := aCollection size.
+ aCollectionSize == 0 ifTrue:[
+ aCollection isSequenceable ifFalse:[
+ self error:'cannot compare non-(sequenceable) collection'.
+ ].
+ ].
+
size < aCollectionSize ifTrue:[
- min := size
+ min := size
] ifFalse:[
- min := aCollectionSize
+ min := aCollectionSize
].
1 to: min do: [:i|
- v1 := self at: i.
- v2 := aCollection at: i.
- (v1 == v2 or:[v1 = v2]) ifFalse:[^ v1 < v2]
+ v1 := self at: i.
+ v2 := aCollection at: i.
+ (v1 == v2 or:[v1 = v2]) ifFalse:[^ v1 < v2]
].
^ size < aCollectionSize
@@ -1217,9 +1223,9 @@
a := 'hello world'.
b := a copy.
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- a < b
- ]
+ 1000000 timesRepeat:[
+ a < b
+ ]
]
|a b|
@@ -1227,9 +1233,9 @@
a := CharacterArray fromString:'hello world'.
b := a copy.
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- a < b
- ]
+ 1000000 timesRepeat:[
+ a < b
+ ]
]
|a b|
@@ -1237,11 +1243,13 @@
a := #[1 2 3 4 5 6 7 8 9 10 11].
b := a copy.
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- a < b
- ]
+ 1000000 timesRepeat:[
+ a < b
+ ]
]
"
+
+ "Modified: / 04-08-2006 / 11:45:10 / cg"
!
<= aCollection
@@ -5121,7 +5129,6 @@
"Created: 14.2.1997 / 16:13:03 / cg"
! !
-
!SequenceableCollection methodsFor:'searching'!
detect:aBlock startingAt:startIndex
@@ -6939,7 +6946,7 @@
!SequenceableCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.238 2006-07-24 12:29:41 fm Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.239 2006-08-07 13:49:01 cg Exp $'
! !
SequenceableCollection initialize!