# HG changeset patch # User Stefan Vogel # Date 1571768798 -7200 # Node ID 7929c3e8bb697517e2e5c8db8b4f994321078d19 # Parent b622eeb3467d682d0b5b5acfcb3bd54d2ff5600a #TUNING by stefan class: SequenceableCollection changed: #indexOf:startingAt:step: stc tuning diff -r b622eeb3467d -r 7929c3e8bb69 SequenceableCollection.st --- 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 : start : + step : 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