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

# BidirectionalCollection Implementations

## Topics

### Structures

[`struct Index`](/documentation/Swift/ReversedCollection/Index)

An index that traverses the same positions as an underlying index,
with inverted traversal direction.

### Instance Properties

[`var last: Self.Element?`](/documentation/Swift/ReversedCollection/last)

The last element of the collection.

### Instance Methods

[`func difference<C>(from: C) -> CollectionDifference<Self.Element>`](/documentation/Swift/ReversedCollection/difference(from:))

Returns the difference needed to produce this collection’s ordered
elements from the given collection.

[`func difference<C>(from: C, by: (C.Element, Self.Element) -> Bool) -> CollectionDifference<Self.Element>`](/documentation/Swift/ReversedCollection/difference(from:by:))

Returns the difference needed to produce this collection’s ordered
elements from the given collection, using the given predicate as an
equivalence test.

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

Returns the distance between two indices.

[`func dropLast(Int) -> Self.SubSequence`](/documentation/Swift/ReversedCollection/dropLast(_:))

Returns a subsequence containing all but the specified number of final
elements.

[`func formIndex(before: inout Self.Index)`](/documentation/Swift/ReversedCollection/formIndex(before:))

Replaces the given index with its predecessor.

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

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

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

Returns the position immediately after the given index.

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

Returns the position immediately before the given index.

[`func joined(separator: String) -> String`](/documentation/Swift/ReversedCollection/joined(separator:)-3e82c)

Returns a new string by concatenating the elements of the sequence,
adding the given separator between each element.

[`func last(where: (Self.Element) throws -> Bool) rethrows -> Self.Element?`](/documentation/Swift/ReversedCollection/last(where:))

Returns the last element of the sequence that satisfies the given
predicate.

[`func lastIndex(of: Self.Element) -> Self.Index?`](/documentation/Swift/ReversedCollection/lastIndex(of:))

Returns the last index where the specified value appears in the
collection.

[`func lastIndex(where: (Self.Element) throws -> Bool) rethrows -> Self.Index?`](/documentation/Swift/ReversedCollection/lastIndex(where:))

Returns the index of the last element in the collection that matches the
given predicate.

[`func suffix(Int) -> Self.SubSequence`](/documentation/Swift/ReversedCollection/suffix(_:))

Returns a subsequence, up to the given maximum length, containing the
final elements of 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)