<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/CollectionOfOne",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s15CollectionOfOneV"
  },
  "title" : "CollectionOfOne"
}
-->

# CollectionOfOne

A collection containing a single element.

```
@frozen struct CollectionOfOne<Element>
```

## Overview

You can use a `CollectionOfOne` instance when you need to efficiently
represent a single value as a collection. For example, you can add a
single element to an array by using a `CollectionOfOne` instance with the
concatenation operator (`+`):

```
let a = [1, 2, 3, 4]
let toAdd = 100
let b = a + CollectionOfOne(toAdd)
// b == [1, 2, 3, 4, 100]
```

## Relationships

### Conforms To

[`ConvertibleFromBytes`](/documentation/Swift/ConvertibleFromBytes)

[`Hashable`](/documentation/Swift/Hashable)

[`Escapable`](/documentation/Swift/Escapable)

[`BidirectionalCollection`](/documentation/Swift/BidirectionalCollection)

[`ConvertibleToBytes`](/documentation/Swift/ConvertibleToBytes)

[`Copyable`](/documentation/Swift/Copyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`Equatable`](/documentation/Swift/Equatable)

[`Collection`](/documentation/Swift/Collection)

[`Sequence`](/documentation/Swift/Sequence)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`MutableCollection`](/documentation/Swift/MutableCollection)

[`RandomAccessCollection`](/documentation/Swift/RandomAccessCollection)

[`ContiguousBytes`](/documentation/Foundation/ContiguousBytes)

---

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)