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

# RandomAccessCollection Implementations

## Topics

### Instance Properties

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

Always zero, just like `startIndex`.

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

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

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

Always zero, just like `endIndex`.

### Instance Methods

[`func distance(from: EmptyCollection<Element>.Index, to: EmptyCollection<Element>.Index) -> Int`](/documentation/Swift/EmptyCollection/distance(from:to:))

The distance between two indexes (always zero).

[`func index(EmptyCollection<Element>.Index, offsetBy: Int) -> EmptyCollection<Element>.Index`](/documentation/Swift/EmptyCollection/index(_:offsetBy:))

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

[`func index(EmptyCollection<Element>.Index, offsetBy: Int, limitedBy: EmptyCollection<Element>.Index) -> EmptyCollection<Element>.Index?`](/documentation/Swift/EmptyCollection/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: EmptyCollection<Element>.Index) -> EmptyCollection<Element>.Index`](/documentation/Swift/EmptyCollection/index(after:))

Always traps.

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

Always traps.

### Subscripts

[`subscript(EmptyCollection<Element>.Index) -> Element`](/documentation/Swift/EmptyCollection/subscript(_:)-1wkfh)

Accesses the element at the given position.

[`subscript(Range<EmptyCollection<Element>.Index>) -> EmptyCollection<Element>.SubSequence`](/documentation/Swift/EmptyCollection/subscript(_:)-5fxf8)

Accesses a contiguous subrange of the collection’s elements.

### Type Aliases

[`typealias Index`](/documentation/Swift/EmptyCollection/Index)

A type that represents a valid position in the collection.

---

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)