How to do that without having to \"scroll\" the entire given array with a \"for\" loop?
The best I can come up with is:
NSMutableArray *replacementArray = [NSMutableArray array];
[originalArray enumerateObjectsUsingBlock:
^(id obj, NSUInteger index, BOOL *stop)
{
[replacementArray addObject:[[obj mutableCopy] autorelease]];
}
];
Which more or less just tells the originalArray
to construct the for loop for you. And if anything it's more work than:
NSMutableArray *replacementArray = [NSMutableArray array];
for(id obj in originalArray)
[replacementArray addObject:[[obj mutableCopy] autorelease]];