Next: , Previous: Collection-copying Collections, Up: Collection


1.36.7 Collection: enumeration

anyOne
Answer an unspecified element of the collection.


beConsistent
This method is private, but it is quite interesting so it is documented. It ensures that a collection is in a consistent state before attempting to iterate on it; its presence reduces the number of overrides needed by collections who try to amortize their execution times. The default implementation does nothing, so it is optimized out by the virtual machine and so it loses very little on the performance side. Note that descendants of Collection have to call it explicitly since #do: is abstract in Collection.


collect: aBlock
Answer a new instance of a Collection containing all the results of evaluating aBlock passing each of the receiver's elements


gather: aBlock
Answer a new instance of a Collection containing all the results of evaluating aBlock, joined together. aBlock should return collections. The result is the same kind as the first collection, returned by aBlock (as for #join).


readStream
Answer a stream that gives elements of the receiver


reject: aBlock
Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, don't answer true


select: aBlock
Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, answer true