# Yahoo! UI Library

### queue 3.0.0b1

Yahoo! UI Library > queue > Queue
Search:
Filters Show Private Show Protected Show Deprecated

## Class Queue

A simple FIFO queue. Items are added to the Queue with add(1..n items) and removed using next().

### Properties

#### _q - `protected {Array}`

The collection of enqueued items

### Methods

#### _init

`protected void _init ( )`
Initialize the queue

Returns: `void`

#### add

`void add ( item* )`
Add 0..n items to the end of the queue

Parameters:
  `item* <MIXED>` 0..n items

Returns: `void`

#### indexOf

`Number indexOf ( needle )`
Returns the current index in the queue of the specified item

Parameters:
  `needle <MIXED>` the item to search for

Returns: `Number`
  the index of the item or -1 if not found

#### next

`MIXED next ( )`
Get the next item in the queue.

Returns: `MIXED`
  the next item in the queue

#### promote

`void promote ( item )`
Moves the referenced item to the head of the queue

Parameters:
  `item <MIXED>` an item in the queue

Returns: `void`

#### remove

`void remove ( item )`
Removes the referenced item from the queue

Parameters:
  `item <MIXED>` an item in the queue

Returns: `void`

#### size

`Number size ( )`
Returns the current number of queued items

Returns: `Number`

Copyright © 2009 Yahoo! Inc. All rights reserved.