# Class: Collection

## Konva. Collection

#### new Collection()

  Collection constructor. Collection extends Array. This class is used in conjunction with Konva.Container#get

  Source:
    - konva-v5.2.0.js, line 639

### Methods

#### <static> toCollection(arr)

  convert array into a collection

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `arr` | Array |

  Source:
    - konva-v5.2.0.js, line 687

#### each(func)

  iterate through node array and run a function for each node. The node and index is passed into the function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `func` | function |

  Source:
    - konva-v5.2.0.js, line 661

  ##### Example

      // get all nodes with name foo inside layer, and set x to 10 for each
      layer.get('.foo').each(function(shape, n) {
        shape.setX(10);
      });

#### toArray()

  convert collection into an array

  Source:
    - konva-v5.2.0.js, line 671