# list.retain_all_copy · Rell standard library · Chromia Docs (concept)

> function retain_ all_ copy(values: collection <-T>): list <T> Return a new list whose elements are those found in both this list and the given collection, 

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

FUNCTION

# list.retain\_all\_copy

```signature
function retain_all_copy(values: collection<-T>): list<T>
```

Return a new list whose elements are those found in both this list and the given collection, or in
other words, the intersection of this list and the given collection.

**Parameters**

* **values** — the other collection

**Returns**

a new list whose elements are the intersection of this list and the given collection

`a.retain_all_copy(b)` is equivalent to `a & b`, where `a` and `b` are lists.

Examples:

* `[1].retain_all_copy([1])` returns `[1]`
* `[1].retain_all_copy([2])` returns `[]`
* `[1, 2, 3].retain_all_copy([2, 3, 4])` returns `[2, 3]`

Since 0.14.16

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