unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} uses Generics.Collections; procedure TForm1.Button1Click(Sender: TObject); var Queue: TQueue<string>; s,str: string; begin Queue := TQueue<string>.Create(); {入列} Queue.Enqueue('AAA'); Queue.Enqueue('BBB'); Queue.Enqueue('CCC'); Queue.Enqueue('DDD'); {查看} str := ''; for s in Queue do str := str + s + ' '; ShowMessage(str); {AAA BBB CCC DDD} {出列, 并查看出列元素} ShowMessage(Queue.Dequeue); {AAA} str := ''; for s in Queue do str := str + s + ' '; ShowMessage(str); {BBB CCC DDD} {查看下一个将要出列的是...} ShowMessage(Queue.Peek); {BBB} Queue.Free; end; end.