NorbertHartl wrote
> anObject = aCollection last

Of course the above and #indexOf: will only work if there are no duplicates
in the collection and #indexOf: will require a lot of extra iterations. If
you need the indices associated to the objects, maybe you should wrap them
e.g. "indexedObjects := objects collectWithIndex: [ :e :i | IndexedObject
object: e index: i ]". Then you can cleanly access the indices whenever you
want.



-----
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/when-iterating-over-a-collection-how-to-determine-the-current-objects-index-tp4810920p4811815.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to