# Yahoo! UI Library

### yui 3.3.0

Yahoo! UI Library > yui > 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().

### Constructor

Queue `( item* )`

Parameters:
  `item* <MIXED>` 0..n items to seed the queue.

### Properties

#### _q - `protected Array`

The collection of enqueued items

### Methods

#### _init

`protected void _init ( )`
Initialize the queue

#### _rls

`string _rls ( what )`
Implentation for building the remote loader service url.

Parameters:
  `what <Array>` the requested modules.

Returns: `string`
  the url for the remote loader service call.

#### add

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

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

Returns: `object`
  this queue.

#### 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

#### last

`MIXED last ( )`
Get the last in the queue. LIFO support.

Returns: `MIXED`
  the last item in the queue.

#### next

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

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

#### remove

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

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

#### size

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

Returns: `Number`
  The size.

Copyright © 2011 Yahoo! Inc. All rights reserved.