# Class: ArrayList

## Phaser. ArrayList

Phaser.ArrayList

#### new ArrayList()

  A set data structure. Allows items to add themselves to and remove themselves from the set. Items can only exist once in the set.

  Source:
    - core/ArrayList.js, line 13

### Members

#### first

  Resets the cursor to the first item in the list and returns it.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `first` | object | The first item in the list.

  Source:
    - core/ArrayList.js, line 139

#### list

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `list` | array | The list.

  Source:
    - core/ArrayList.js, line 30

#### next

  Gets the next item in the list and returns it, advancing the cursor.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `next` | object | Advanced the cursor and return.

  Source:
    - core/ArrayList.js, line 164

#### position

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `position` | number | Current cursor position.

  Default Value:
    - 0
  Source:
    - core/ArrayList.js, line 25

#### total

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `total` | number | Number of objects in the list.

  Default Value:
    - 0
  Source:
    - core/ArrayList.js, line 19

### Methods

#### add(child) → {object}

  Adds a new element to this list. The item can only exist in the list once.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `child` | object | The element to add to this list. Can be a Phaser.Sprite or any other object you need to quickly iterate through.

  Source:
    - core/ArrayList.js, line 36

  ##### Returns:

  The child that was added.

  Type
    object

#### callAll(callback, parameter)

  Calls a function on all members of this list, using the member as the context for the callback. The function must exist on the member.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `callback` | function |  | The function to call.
  `parameter` | * | <repeatable> | Additional parameters that will be passed to the callback.

  Source:
    - core/ArrayList.js, line 113

#### exists(child) → {boolean}

  Checks for the child within this list.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `child` | object | The element to get the list index for.

  Source:
    - core/ArrayList.js, line 68

  ##### Returns:

  True if the child is found in the list, otherwise false.

  Type
    boolean

#### getIndex(child) → {number}

  Gets the index of the child in the list, or -1 if it isn't in the list.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `child` | object | The element to get the list index for.

  Source:
    - core/ArrayList.js, line 55

  ##### Returns:

  The index of the child or -1 if not found.

  Type
    number

#### remove(child) → {object}

  Removes the given element from this list if it exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `child` | object | The child to be removed from the list.

  Source:
    - core/ArrayList.js, line 93

  ##### Returns:

  child - The child that was removed.

  Type
    object

#### reset()

  Resets the list length and drops all items in the list.

  Source:
    - core/ArrayList.js, line 81