【使用】:集合的元素个数。
值得注意的是:字符串是字符的集合。
Count
/// The number of elements in the collection.
// : 元素个数
///
/// To check whether a collection is empty, use its `isEmpty` property
/// instead of comparing `count` to zero. Unless the collection guarantees
/// random-access performance, calculating `count` can be an O(*n*)
/// operation.
// :要检查集合是否是空的,请使用它的' isEmpty '属性,代替将' count '与0进行比较。除非集合保证了随机访问性能,否则计算“count”可以是O(*n*)操作。
///
/// - Complexity: O(1) if the collection conforms to
/// `RandomAccessCollection`; otherwise, O(*n*), where *n* is the length
/// of the collection.
@inlinable public var count: Int { get }
underestimatedCount
/// A value less than or equal to the number of elements in the collection.
// : 一个值少于或等于元素的个数
///
/// - Complexity: O(1) if the collection conforms to
/// `RandomAccessCollection`; otherwise, O(*n*), where *n* is the length
/// of the collection.
@inlinable public var underestimatedCount: Int { get }
网友评论