Skip to content

Commit 6669850

Browse files
authored
Merge pull request #4415 from natecook1000/swift-3.0-branch
[swift-3.0-branch] Documentation revisions
2 parents f5cadf1 + 92bca60 commit 6669850

22 files changed

+119
-121
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ extension _ArrayBuffer {
112112

113113
/// Convert to an NSArray.
114114
///
115-
/// O(1) if the element type is bridged verbatim, O(N) otherwise.
115+
/// O(1) if the element type is bridged verbatim, O(*n*) otherwise.
116116
public func _asCocoaArray() -> _NSArrayCore {
117117
return _fastPath(_isNative) ? _native._asCocoaArray() : _nonNative
118118
}

stdlib/public/core/ArrayType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protocol _ArrayProtocol
6161
///
6262
/// - returns: The removed element.
6363
///
64-
/// - Complexity: Worst case O(N).
64+
/// - Complexity: Worst case O(*n*).
6565
///
6666
/// - Precondition: `count > index`.
6767
@discardableResult

stdlib/public/core/Arrays.swift.gyb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ if True:
169169
///
170170
/// Arrays are one of the most commonly used data types in an app. You use
171171
/// arrays to organize your app's data. Specifically, you use the `Array` type
172-
/// to hold elements of a single type, the array's `Element` type. An array's
173-
/// elements can be anything from an integer to a string to a class.
172+
/// to hold elements of a single type, the array's `Element` type. An array
173+
/// can store any kind of elements---from integers to strings to classes.
174174
///
175175
/// Swift makes it easy to create arrays in your code using an array literal:
176176
/// simply surround a comma separated list of values with square brackets.
@@ -261,8 +261,8 @@ if True:
261261
/// var students = ["Ben", "Ivy", "Jordell"]
262262
///
263263
/// To add single elements to the end of an array, use the `append(_:)` method.
264-
/// Add multiple elements at once by passing another array or a sequence of
265-
/// any kind to the `append(contentsOf:)` method.
264+
/// Add multiple elements at the same time by passing another array or a
265+
/// sequence of any kind to the `append(contentsOf:)` method.
266266
///
267267
/// students.append("Maxime")
268268
/// students.append(contentsOf: ["Shakia", "William"])
@@ -271,8 +271,8 @@ if True:
271271
/// You can add new elements in the middle of an array by using the
272272
/// `insert(_:at:)` method for single elements and by using
273273
/// `insert(contentsOf:at:)` to insert multiple elements from another
274-
/// collection or array literal. The elements at that index and later are
275-
/// shifted back to make room.
274+
/// collection or array literal. The elements at that index and later indices
275+
/// are shifted back to make room.
276276
///
277277
/// students.insert("Liam", at: 3)
278278
/// // ["Ben", "Ivy", "Jordell", "Liam", "Maxime", "Shakia", "William"]
@@ -288,8 +288,8 @@ if True:
288288
/// students.removeLast()
289289
/// // ["Ivy", "Jordell", "Liam", "Maxime", "Shakia"]
290290
///
291-
/// You can replace an existing element with a new value by assigning to the
292-
/// subscript.
291+
/// You can replace an existing element with a new value by assigning the new
292+
/// value to the subscript.
293293
///
294294
/// if let i = students.index(of: "Maxime") {
295295
/// students[i] = "Max"
@@ -423,7 +423,7 @@ if True:
423423
///
424424
/// Bridging from `Array` to `NSArray` takes O(1) time and O(1) space if the
425425
/// array's elements are already instances of a class or an `@objc` protocol;
426-
/// otherwise, it takes O(n) time and space.
426+
/// otherwise, it takes O(*n*) time and space.
427427
///
428428
/// Bridging from `NSArray` to `Array` first calls the `copy(with:)`
429429
/// (`- copyWithZone:` in Objective-C) method on the array to get an immutable

stdlib/public/core/Collection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ public struct IndexingIterator<
528528
/// able to calculate its `count` property in O(1) time. Conversely, because a
529529
/// forward or bidirectional collection must traverse the entire collection to
530530
/// count the number of contained elements, accessing its `count` property is
531-
/// an O(N) operation.
531+
/// an O(*n*) operation.
532532
public protocol Collection : Indexable, Sequence {
533533
/// A type that can represent the number of steps between a pair of
534534
/// indices.
@@ -751,7 +751,7 @@ public protocol Collection : Indexable, Sequence {
751751
/// or `Optional(nil)` if an element was determined to be missing;
752752
/// otherwise, `nil`.
753753
///
754-
/// - Complexity: O(N).
754+
/// - Complexity: O(*n*)
755755
func _customIndexOfEquatableElement(_ element: Iterator.Element) -> Index??
756756

757757
/// The first element of the collection.
@@ -1209,7 +1209,7 @@ extension Collection {
12091209
/// Customization point for `Collection.index(of:)`.
12101210
///
12111211
/// Define this method if the collection can find an element in less than
1212-
/// O(N) by exploiting collection-specific knowledge.
1212+
/// O(*n*) by exploiting collection-specific knowledge.
12131213
///
12141214
/// - Returns: `nil` if a linear search should be attempted instead,
12151215
/// `Optional(nil)` if the element was not found, or

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
467467
///
468468
/// - Precondition: `U` is a class or `@objc` existential.
469469
///
470-
/// - Complexity: O(N).
470+
/// - Complexity: O(*n*)
471471
func storesOnlyElementsOfType<U>(
472472
_: U.Type
473473
) -> Bool {

stdlib/public/core/Equatable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public func != <T : Equatable>(lhs: T, rhs: T) -> Bool {
191191
/// same value. For value equality, see the equal-to operator (`==`) and the
192192
/// `Equatable` protocol.
193193
///
194-
/// The following example defines an `IntegerRef` type; an integer type with
194+
/// The following example defines an `IntegerRef` type, an integer type with
195195
/// reference semantics.
196196
///
197197
/// class IntegerRef: Equatable {
@@ -218,7 +218,7 @@ public func != <T : Equatable>(lhs: T, rhs: T) -> Bool {
218218
/// // Prints "true"
219219
///
220220
/// The identical-to operator (`===`) returns `false` when comparing two
221-
/// references to different objects instances, even if the two instances have
221+
/// references to different object instances, even if the two instances have
222222
/// the same value.
223223
///
224224
/// let c = IntegerRef(10)

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ public struct ${Self}<Element>
928928

929929
/// The number of elements.
930930
///
931-
/// - Complexity: ${'O(1)' if Traversal == 'RandomAccess' else 'O(N)'}
931+
/// - Complexity: ${'O(1)' if Traversal == 'RandomAccess' else 'O(*n*)'}
932932
public var count: IntMax {
933933
return _box._count
934934
}

stdlib/public/core/Filter.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public struct ${Self}<
202202
///
203203
/// In an empty collection, `startIndex == endIndex`.
204204
///
205-
/// - Complexity: O(N), where N is the ratio between unfiltered and
205+
/// - Complexity: O(*n*), where *n* is the ratio between unfiltered and
206206
/// filtered collection counts.
207207
public var startIndex: Index {
208208
var index = _base.startIndex

stdlib/public/core/HashedCollections.swift.gyb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ internal struct _UnmanagedAnyObjectArray {
421421
/// set's `Element` type is neither a class nor an `@objc` protocol, any
422422
/// required bridging of elements occurs at the first access of each element,
423423
/// so the first operation that uses the contents of the set (for example, a
424-
/// membership test) can take O(N).
424+
/// membership test) can take O(*n*).
425425
///
426426
/// Bridging from `NSSet` to `Set` first calls the `copy(with:)` method
427427
/// (`- copyWithZone:` in Objective-C) on the set to get an immutable copy and
@@ -996,8 +996,8 @@ public struct Set<Element : Hashable> :
996996
///
997997
/// In the following example, the `bothNeighborsAndEmployees` set is made up
998998
/// of the elements that are in *both* the `employees` and `neighbors` sets.
999-
/// Elements that are only in one or the other are left out of the result of
1000-
/// the intersection.
999+
/// Elements that are in either one or the other, but not both, are left out
1000+
/// of the result of the intersection.
10011001
///
10021002
/// let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
10031003
/// let neighbors = ["Bethany", "Eric", "Forlani", "Greta"]
@@ -1739,7 +1739,7 @@ public struct Dictionary<Key : Hashable, Value> :
17391739
/// the dictionary; otherwise, `nil`.
17401740
@inline(__always)
17411741
public func index(forKey key: Key) -> Index? {
1742-
// Complexity: amortized O(1) for native storage, O(N) when wrapping an
1742+
// Complexity: amortized O(1) for native storage, O(*n*) when wrapping an
17431743
// NSDictionary.
17441744
return _variantStorage.index(forKey: key)
17451745
}
@@ -5217,8 +5217,8 @@ extension Set {
52175217
///
52185218
/// In the following example, the `bothNeighborsAndEmployees` set is made up
52195219
/// of the elements that are in *both* the `employees` and `neighbors` sets.
5220-
/// Elements that are only in one or the other are left out of the result of
5221-
/// the intersection.
5220+
/// Elements that are in either one or the other, but not both, are left out
5221+
/// of the result of the intersection.
52225222
///
52235223
/// let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
52245224
/// let neighbors: Set = ["Bethany", "Eric", "Forlani", "Greta"]

stdlib/public/core/LazyCollection.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extension ${Self} : Sequence {
8686
/// Returns a value less than or equal to the number of elements in
8787
/// `self`, **nondestructively**.
8888
///
89-
/// - Complexity: O(N).
89+
/// - Complexity: O(*n*)
9090
public var underestimatedCount: Int { return _base.underestimatedCount }
9191

9292
public func _copyToContiguousArray()
@@ -158,7 +158,7 @@ extension ${Self} : ${TraversalCollection} {
158158
/// Returns the number of elements.
159159
///
160160
/// - Complexity: O(1) if `Self` conforms to `RandomAccessCollection`;
161-
/// O(N) otherwise.
161+
/// O(*n*) otherwise.
162162
public var count: Base.IndexDistance {
163163
return _base.count
164164
}
@@ -169,7 +169,7 @@ extension ${Self} : ${TraversalCollection} {
169169
/// Returns `Optional(Optional(index))` if an element was found;
170170
/// `nil` otherwise.
171171
///
172-
/// - Complexity: O(N).
172+
/// - Complexity: O(*n*)
173173
public func _customIndexOfEquatableElement(
174174
_ element: Base.Iterator.Element
175175
) -> Index?? {

0 commit comments

Comments
 (0)