I ran into the following problem (related to FamixModelExtractionTest
even if it's more general)
(#((1) (3) () ()) flatCollect: [ :each ])
returns
#(1 3 nil nil)
when one expects #(1 3)
flatCollect: is defined in Colllection, I dont want to override it
if possible.
Collection>>flatCollect: aBlock
| stream |
self isEmpty ifTrue: [ ^ self copy ].
stream := (self species new: self size) nsWriteStream.
self do: [ :each | stream nextPutAll: (aBlock value: each) ].
^ stream contents
Can someone find an elegant solution which would "shrink" the
resulting array to its non-nil content?
--
Simon