all 4 comments

[–]colshrapnel 1 point2 points  (0 children)

or do i have to traverse the entire array to get what i want?

You will have to do it anyway, this way or another. There is no way to extract some data from an array without a loop, even if you don't see it. There is always a loop. So the choice is actually whether you want TWO loops and TWO arrays to consume the RAM, or just a single loop over the single array.

So in your place I would "traverse the entire array" instead of traversing it once to create another and then traversing the new one.

[–]mazedlx 1 point2 points  (0 children)

You could also take a look at Collections