#TUNING by stefan
class: SequenceableCollection
changed: #indexOf:startingAt:step:
stc tuning
--- a/SequenceableCollection.st Tue Oct 22 20:26:06 2019 +0200
+++ b/SequenceableCollection.st Tue Oct 22 20:26:38 2019 +0200
@@ -8782,15 +8782,18 @@
indexOf:anElement startingAt:start step:step
"search the collection for anElement, starting the search at index start;
if found, return the index otherwise return 0.
+ Only look at every step element.
The comparison is done using =
(i.e. equality test - not identity test)."
|startIndex "{ Class: SmallInteger }"
+ stepCount "{ Class: SmallInteger }"
stop "{ Class: SmallInteger }" |
startIndex := start.
stop := self size.
- startIndex to:stop by:step do:[:index |
+ stepCount := step.
+ startIndex to:stop by:stepCount do:[:index |
anElement = (self at:index) ifTrue:[^ index].
].
^ 0
@@ -8798,6 +8801,7 @@
"
args: anElement : <object>
start : <integer>
+ step : <integer>
returns: elementIndex - if found
0 - if not found
@@ -8809,6 +8813,7 @@
"
"Created: / 18-09-2018 / 14:06:32 / Stefan Vogel"
+ "Modified (comment): / 22-10-2019 / 19:57:19 / Stefan Vogel"
!
indexOfAny:aCollection