# Queue

#### new Cesium.Queue()
Core/Queue.js 14

  A queue that can enqueue items at the end, and dequeue items from the front.

### Members

#### readonlylength : Number
Core/Queue.js 29

  The length of the queue.

### Methods

#### clear()
Core/Queue.js 99

  Remove all items from the queue.

#### contains(item)
Core/Queue.js 92

  Check whether this queue contains the specified item.

  Name | Type | Description
  --- | --- | ---
  `item` | Object | The item to search for.

#### dequeue() → Object
Core/Queue.js 51

  Dequeues an item. Returns undefined if the queue is empty.

  ##### Returns:

  The the dequeued item.

#### enqueue(item)
Core/Queue.js 41

  Enqueues the specified item.

  Name | Type | Description
  --- | --- | ---
  `item` | Object | The item to enqueue.

#### peek() → Object
Core/Queue.js 79

  Returns the item at the front of the queue. Returns undefined if the queue is empty.

  ##### Returns:

  The item at the front of the queue.

#### sort(compareFunction)
Core/Queue.js 108

  Sort the items in the queue in-place.

  Name | Type | Description
  --- | --- | ---
  `compareFunction` | Queue~Comparator | A function that defines the sort order.

### Type Definitions

#### Comparator(a, b) → Number
Core/Queue.js 118

  A function used to compare two items while sorting a queue.

  Name | Type | Description
  --- | --- | ---
  `a` | Object | An item in the array.
  `b` | Object | An item in the array.

  ##### Returns:

  Returns a negative value if `a` is less than `b`, a positive value if `a` is greater than `b`, or 0 if `a` is equal to `b`.

  ##### Example:

      function compareNumbers(a, b) {
          return a - b;
      }