[swift-users] how to create an array by adding/removing from another array?
jens at mooseyard.com
Wed Aug 24 10:50:09 CDT 2016
> On Aug 24, 2016, at 7:07 AM, Jean-Denis Muys via swift-users <swift-users at swift.org> wrote:
> However I was wondering if it was possible (preferable?) to do it in a more “functional” style.
Apple’s Foundation framework has Array.arrayByAddingObject (but not ByRemoving).
However, this would not be preferable (at least in performance) due to all the copying. Performance of appending n items would be O(n^2), for instance, vs. O(n) for appending in-place.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users