Skip to content

Commit a6b440f

Browse files
committed
Documentation
1 parent 8165c59 commit a6b440f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Sources/SortedArray.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ extension SortedArray: RandomAccessCollection {
9898
return _elements[position]
9999
}
100100

101+
/// Like `Sequence.filter(_:)`, but returns a `SortedArray` instead of an `Array`.
102+
/// We can do this efficiently because filtering doesn't change the sort order.
101103
public func filter(_ isIncluded: (Element) throws -> Bool) rethrows -> SortedArray<Element> {
102104
let newElements = try _elements.filter(isIncluded)
103105
return SortedArray(sorted: newElements, areInIncreasingOrder: areInIncreasingOrder)

0 commit comments

Comments
 (0)