SequenceableCollection.st
changeset 22237 fb6d54514410
parent 22223 579090043bea
child 22273 50bab26735a7
equal deleted inserted replaced
22236:14865585b530 22237:fb6d54514410
  2334      #(1 2 3 4 5 6.0) asOrderedCollection hash
  2334      #(1 2 3 4 5 6.0) asOrderedCollection hash
  2335      #[1 2 3 4 5 6] hash
  2335      #[1 2 3 4 5 6] hash
  2336     "
  2336     "
  2337 
  2337 
  2338     "Modified: / 27.3.1998 / 17:33:49 / cg"
  2338     "Modified: / 27.3.1998 / 17:33:49 / cg"
       
  2339 !
       
  2340 
       
  2341 indexOfFirstDifferenceWith:anotherCollection
       
  2342     "return the index of the first element which is different to the corresponding
       
  2343      element in anotherCollection. 0 if they are all the same.
       
  2344      The comparison is by equality, i.e. using #="
       
  2345      
       
  2346     ^ self with:anotherCollection findFirst:[:a :b | a ~= b] 
       
  2347 
       
  2348     "
       
  2349      'hello' indexOfFirstDifferenceWith:'helLo' 
       
  2350      'hello' indexOfFirstDifferenceWith:'hello'   
       
  2351      'hello' indexOfFirstDifferenceWith:'hello1'   
       
  2352      'hello1' indexOfFirstDifferenceWith:'hello' 
       
  2353     "
       
  2354 
       
  2355     "Created: / 31-08-2017 / 20:10:36 / cg"
  2339 !
  2356 !
  2340 
  2357 
  2341 isSameSequenceAs:otherCollection
  2358 isSameSequenceAs:otherCollection
  2342     "Answer whether the receiver's size is the same as otherCollection's size,
  2359     "Answer whether the receiver's size is the same as otherCollection's size,
  2343      and each of the receiver's elements equal the corresponding element of otherCollection.
  2360      and each of the receiver's elements equal the corresponding element of otherCollection.