Peek: Variant;
The Peek method gets value of the element that is placed as the first one from a queue.
After extracting element is not removed from the queue.
Sub UserProc;
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 UserProc;
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: