The Trunk: Collections-ul.683.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.683.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.683.mcz

==================== Summary ====================

Name: Collections-ul.683
Author: ul
Time: 30 March 2016, 2:23:29.737891 am
UUID: f0634d1c-37d8-4ed1-84cc-6439546aaa74
Ancestors: Collections-ul.682

Improvement #peekFor: performance.

=============== Diff against Collections-ul.682 ===============

Item was changed:
  ----- Method: PositionableStream>>peekFor: (in category 'accessing') -----
  peekFor: anObject
  "Answer false and do not move over the next element if it is not equal to
  the argument, anObject, or if the receiver is at the end. Answer true
  and increment the position for accessing elements, if the next element is
  equal to anObject."
 
- | nextObject |
  self atEnd ifTrue: [^false].
- nextObject := self next.
- "peek for matching element"
- anObject = nextObject ifTrue: [^true].
  "gobble it if found"
+ self next = anObject ifTrue: [ ^true ].
  position := position - 1.
  ^false!