Initializerswift 6.1.2Swift
init(_:)
Creates an AnyRandomAccessCollection having the same underlying collection as other.
init(_ other: AnyRandomAccessCollection<Element>) Creates an AnyRandomAccessCollection having the same underlying collection as other.
init(_ other: AnyRandomAccessCollection<Element>) import Swift@frozen struct AnyRandomAccessCollection<Element>A type-erased wrapper over any collection with indices that support random access traversal.
init?(_ other: AnyBidirectionalCollection<Element>) Creates an AnyRandomAccessCollection having the same underlying collection as other.
init?(_ other: AnyCollection<Element>) Creates an AnyRandomAccessCollection having the same underlying collection as other.
init<C>(_ base: C) where Element == C.Element, C : RandomAccessCollection Creates a type-erased collection that wraps the given collection.
var count: Int { get }The number of elements.
var endIndex: AnyRandomAccessCollection<Element>.Index { get }The collection’s “past the end” position—that is, the position one greater than the last valid subscript argument.
var startIndex: AnyRandomAccessCollection<Element>.Index { get }The position of the first element in a non-empty collection.
var underestimatedCount: Int { get }subscript(bounds: Range<AnyRandomAccessCollection<Element>.Index>) -> AnyRandomAccessCollection<Element>.SubSequence { get } subscript(position: AnyRandomAccessCollection<Element>.Index) -> Element { get } Accesses the element indicated by position.
func distance(from start: AnyRandomAccessCollection<Element>.Index, to end: AnyRandomAccessCollection<Element>.Index) -> Int func drop(while predicate: (Element) throws -> Bool) rethrows -> AnyRandomAccessCollection<Element> func dropFirst(_ n: Int = 1) -> AnyRandomAccessCollection<Element> func dropLast(_ n: Int = 1) -> AnyRandomAccessCollection<Element> func filter(_ isIncluded: (Element) throws -> Bool) rethrows -> [Element] func forEach(_ body: (Element) throws -> Void) rethrows func formIndex(_ i: inout AnyRandomAccessCollection<Element>.Index, offsetBy n: Int) func formIndex(_ i: inout AnyRandomAccessCollection<Element>.Index, offsetBy n: Int, limitedBy limit: AnyRandomAccessCollection<Element>.Index) -> Bool func formIndex(after i: inout AnyRandomAccessCollection<Element>.Index) func formIndex(before i: inout AnyRandomAccessCollection<Element>.Index) func index(_ i: AnyRandomAccessCollection<Element>.Index, offsetBy n: Int) -> AnyRandomAccessCollection<Element>.Index func index(_ i: AnyRandomAccessCollection<Element>.Index, offsetBy n: Int, limitedBy limit: AnyRandomAccessCollection<Element>.Index) -> AnyRandomAccessCollection<Element>.Index? func index(after i: AnyRandomAccessCollection<Element>.Index) -> AnyRandomAccessCollection<Element>.Index func index(before i: AnyRandomAccessCollection<Element>.Index) -> AnyRandomAccessCollection<Element>.Index func makeIterator() -> AnyRandomAccessCollection<Element>.Iterator Returns an iterator over the elements of this collection.
func map<T, E>(_ transform: (Element) throws(E) -> T) throws(E) -> [T] where E : Error func prefix(_ maxLength: Int = 1) -> AnyRandomAccessCollection<Element> func prefix(while predicate: (Element) throws -> Bool) rethrows -> AnyRandomAccessCollection<Element> func suffix(_ maxLength: Int) -> AnyRandomAccessCollection<Element> typealias Index = AnyIndextypealias Indices = DefaultIndices<AnyRandomAccessCollection<Element>>typealias Iterator = AnyIterator<Element>typealias SubSequence = AnyRandomAccessCollection<Element>