# set · Rell standard library · Chromia Docs (concept)

> type set<T>: collection <T> A mutable set of elements of type T , where T is immutable. Subtype of collection<T> . Implemented
as a hash-set, with iteratio

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/

TYPE

# set

```signature
type set<T>: collection<T>
```

A mutable set of elements of type `T`, where `T` is immutable. Subtype of `collection<T>`. Implemented
as a hash-set, with iteration order determined by the order in which the elements were added.

**See Also**

1. [`collection` - Rell Standard Library](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/collection/)

Since 0.6.0

## Methods

[add](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/add/)
:   Append an element to the end of this collection.

[addAll](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/add-all/)
:   Add all elements from another collection to the end of this collection.

[add\_all](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/add_all/)
:   Add all elements from another collection to the end of this collection.

[add\_all\_copy](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/add_all_copy/)
:   Returns a new set containing the elements of this set and the elements of a given collection.

[clear](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/clear/)
:   Clear this collection; i.e. remove all its elements. Immediately after this method returns, this

[contains](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/contains/)
:   Check if this collection contains the given element.

[containsAll](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/contains-all/)
:   Check if this collection contains all elements of another collection.

[contains\_all](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/contains_all/)
:   Check if this collection contains all elements of another collection.

[empty](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/empty/)
:   Check if this collection is empty.

[join\_to\_text](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/join_to_text/)
:   Generate a textual representation of this iterable.

[len](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/len/)
:   Get the size (number of elements) of this collection.

[remove](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/remove/)
:   Remove an element from this collection.

[removeAll](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/remove-all/)
:   Remove all elements in another collection from this collection.

[remove\_all](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/remove_all/)
:   Remove all elements in another collection from this collection.

[remove\_all\_copy](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/remove_all_copy/)
:   Returns a new set containing the elements of this set, but without any elements that occur in the

[retain\_all](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/retain_all/)
:   Retain in this collection only those elements found in the given collection. In other words, remove

[retain\_all\_copy](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/retain_all_copy/)
:   Returns a new set whose elements are those found in both this set and the given collection, or in

[set](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/set/)

[size](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/size/)
:   Get the size (number of elements) of this collection.

[sorted](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/sorted/)
:   Sorts the elements of this collection into a list. This collection is not modified.

[str](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/str/)
:   Returns a textual representation of this collection.

[to\_text](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/set/to_text/)
:   Returns a textual representation of this collection.

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/%5Broot%5D/set/index.html)Generated API reference, mirrored from the live docs
