Represents an iterable collection of elements of finite size, with a well-defined notion of value equality. `Collection` is the abstract supertype of `List`, `Map`, and `Set`.

A `Collection` forms a `Category` of its elements, and is `Iterable`. The elements of a collection are not necessarily distinct when compared using `Object.equals()`.

A `Collection` may be cloned. If a collection is immutable, it is acceptable that `clone()` produce a reference to the collection itself. If a collection is mutable, `clone()` should produce a collection containing references to the same elements, with the same structure as the original collection—that is, it should produce a shallow copy of the collection.

All `Collection`s are required to support a well-defined notion of value equality, but the definition of equality depends upon the kind of collection. Equality for `Map`s and `Set`s has a quite different definition to equality for `List`s.

See also `List`, `Map`, `Set`

no type hierarchy

- `Collection`
  - `Iterable`
    - `Category`

- `Collection`
  - `List`
    - `Array`
    - `Sequential`
      - `Empty`
        - `empty`
      - `Sequence`
        - `ArraySequence`
        - `Range`
        - `Singleton`
        - `Tuple`
    - `String`
    - `StringBuilder`
  - `Map`
    - `emptyMap`
  - `Set`
    - `emptySet`

Attributes
`empty` | Source Code `shared actual default Boolean empty` Determine if the collection is empty, that is, if it has no elements. Refines `Iterable.empty`
`string` | Source Code `shared actual default String string` A string of form `"{ x, y, z }"` where `x`, `y`, and `z` are the `string` representations of the elements of this collection, as produced by the iterator of the collection, or the string `"{}"` if this collection is empty. If the collection iterator produces the value `null`, the string representation contains the string `"<null>"`. Refines `Iterable.string` ultimately refines `Object.string`

Inherited Attributes
Attributes inherited from: `Object` `Object.hash`
Attributes inherited from: `Iterable<Element,Absent>` `Iterable.coalesced`, `Iterable.cycled`, `Iterable.empty`, `Iterable.exceptLast`, `Iterable.first`, `Iterable.indexed`, `Iterable.last`, `Iterable.paired`, `Iterable.rest`, `Iterable.size`, `Iterable.string`

Methods
`clone` | Source Code `shared formal Collection<Element> clone()` A shallow copy of this collection, that is, a collection with identical elements which does not change if this collection changes. If this collection is immutable, it is acceptable to return a reference to this collection. If this collection is mutable, a newly instantiated collection must be returned.
`contains` | Source Code `shared actual default Boolean contains(Object element)` Return `true` if the given object is an element of this collection. In this default implementation, and in most refining implementations, return `false` otherwise. An acceptable refining implementation may return `true` for objects which are not elements of the collection, but this is not recommended. (For example, the `contains()` method of `String` returns `true` for any substring of the string.) Refines `Iterable.contains` ultimately refines `Category.contains`

Inherited Methods
Methods inherited from: `Object` `Object.equals()`
Methods inherited from: `Category<Element>` `Category.contains()`, `Category.containsAny()`, `Category.containsEvery()`
Methods inherited from: `Iterable<Element,Absent>` `Iterable.any()`, `Iterable.by()`, `Iterable.chain()`, `Iterable.collect()`, `Iterable.count()`, `Iterable.defaultNullElements()`, `Iterable.every()`, `Iterable.filter()`, `Iterable.find()`, `Iterable.findLast()`, `Iterable.flatMap()`, `Iterable.fold()`, `Iterable.follow()`, `Iterable.getFromFirst()`, `Iterable.interpose()`, `Iterable.iterator()`, `Iterable.longerThan()`, `Iterable.map()`, `Iterable.max()`, `Iterable.partition()`, `Iterable.product()`, `Iterable.reduce()`, `Iterable.repeat()`, `Iterable.scan()`, `Iterable.select()`, `Iterable.sequence()`, `Iterable.shorterThan()`, `Iterable.skip()`, `Iterable.skipWhile()`, `Iterable.sort()`, `Iterable.spread()`, `Iterable.take()`, `Iterable.takeWhile()`