Yeah, personally I would go for collect
, since turning an iterable into a Vector
(or more generally an Array
) is exactly its purpose, so in my opinion the code is more readable that way. I wouldn’t really worry about comparing implementations unless it turned out to be a performance bottleneck (in which case you might want to avoid allocating arrays anyway, depending on the situation).
1 Like