[squeak-dev] The Trunk: Collections-ct.951.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Jul 5 09:01:19 UTC 2021
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.951.mcz
==================== Summary ====================
Name: Collections-ct.951
Author: ct
Time: 30 June 2021, 11:28:40.378415 pm
UUID: 20041ac2-26ea-5547-a7df-b98ad4b192d6
Ancestors: Collections-mt.945
Fixes Stream >> #take:. Unlike in #any:, we must not return nil values from #next here but the enumeration earlier. However, we can keep the fast behavior for ReadStreams in which #next: automatically stops the enumeration at the end of the receiver. See CollectionsTests-ct.361.
Supersedes Collections-ct.950. Thanks to Marcel for the fast review!
=============== Diff against Collections-mt.945 ===============
Item was added:
+ ----- Method: ReadStream>>take: (in category 'collections - accessing') -----
+ take: maxNumberOfElements
+ "Overridden for efficiency."
+
+ ^ self next: maxNumberOfElements!
Item was changed:
----- Method: Stream>>take: (in category 'collections - accessing') -----
take: maxNumberOfElements
"See Collection protocol."
+
+ | aCollection |
+ aCollection := OrderedCollection new.
+ maxNumberOfElements timesRepeat: [
+ self atEnd ifTrue: [^ aCollection].
+ aCollection addLast: self next].
+ ^ aCollection!
-
- ^ self any: maxNumberOfElements!
More information about the Squeak-dev
mailing list
|