IQueue.Peek

Syntax

Peek: Variant;

Description

The Peek method extracts value of the element that is placed as the first one from a queue. After extracting element is not removed from the queue.

Example

Sub Main;

Var

Que: IQueue;

i: Integer;

v: Variant;

Begin

Que:=New Queue.Create;

For i:=0 To Math.RandBetweenI(50,100) Do

Que.Enqueue("Value "+Math.RandBetweenI(0,100).ToString);

End For;

v:=Que.Peek;

End Sub Main;

After executing the example a queue of random elements is created, and the "v" variable contains value of the first element, placed to the queue.

See also:

IQueue