<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/CollectionOfOne/RandomAccessCollection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "RandomAccessCollection Implementations"
}
-->

# RandomAccessCollection Implementations

## Topics

### Instance Properties

[`var endIndex: CollectionOfOne<Element>.Index`](/documentation/Swift/CollectionOfOne/endIndex)

The “past the end” position—that is, the position one greater than the
last valid subscript argument.

[`var indices: Range<Self.Index>`](/documentation/Swift/CollectionOfOne/indices-swift.property)

The indices that are valid for subscripting the collection, in ascending
order.

[`var startIndex: CollectionOfOne<Element>.Index`](/documentation/Swift/CollectionOfOne/startIndex)

The position of the first element.

### Instance Methods

[`func distance(from: Self.Index, to: Self.Index) -> Self.Index.Stride`](/documentation/Swift/CollectionOfOne/distance(from:to:))

Returns the distance between two indices.

[`func index(Self.Index, offsetBy: Self.Index.Stride) -> Self.Index`](/documentation/Swift/CollectionOfOne/index(_:offsetBy:))

Returns an index that is the specified distance from the given index.

[`func index(Self.Index, offsetBy: Int, limitedBy: Self.Index) -> Self.Index?`](/documentation/Swift/CollectionOfOne/index(_:offsetBy:limitedBy:))

Returns an index that is the specified distance from the given index,
unless that distance is beyond a given limiting index.

[`func index(after: CollectionOfOne<Element>.Index) -> CollectionOfOne<Element>.Index`](/documentation/Swift/CollectionOfOne/index(after:))

Returns the position immediately after the given index.

[`func index(before: CollectionOfOne<Element>.Index) -> CollectionOfOne<Element>.Index`](/documentation/Swift/CollectionOfOne/index(before:))

Returns the position immediately before the given index.

### Subscripts

[`subscript(Range<Int>) -> CollectionOfOne<Element>.SubSequence`](/documentation/Swift/CollectionOfOne/subscript(_:)-16mfr)

Accesses a contiguous subrange of the collection’s elements.

[`subscript(Int) -> Element`](/documentation/Swift/CollectionOfOne/subscript(_:)-876qi)

Accesses the element at the specified position.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)