Skip to content

Commit 7d3aa28

Browse files
committed
Clean up implementation
1 parent 6ac6dc9 commit 7d3aa28

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Foundation/NSArray.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,11 @@ public class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NS
180180
objects.reserveCapacity(objects.count + range.length)
181181

182182
if self.dynamicType === NSArray.self || self.dynamicType === NSMutableArray.self {
183-
objects.insertContentsOf(_storage[range.toRange()!], at: 0)
183+
objects += _storage[range.toRange()!]
184184
return
185185
}
186186

187-
for idx in 0..<range.length {
188-
objects.insert(self[range.location + idx], atIndex: idx)
189-
}
187+
objects += range.toRange()!.map { self[$0] }
190188
}
191189

192190
public func indexOfObject(anObject: AnyObject) -> Int {

0 commit comments

Comments
 (0)