Doubly-linked list/Definition: Difference between revisions

Added Delphi example
(Added Delphi example)
Line 959:
Empty from tail: saw I cat a really it Was
</pre>
=={{header|Delphi}}==
{{libheader| System.SysUtils}}
{{libheader| boost.LinkedList}}[[https://github.com/MaiconSoft/DelphiBoostLib]]
{{Trans|C#}}
<lang Delphi>
program Doubly_linked;
 
{$APPTYPE CONSOLE}
 
uses
System.SysUtils,
boost.LinkedList;
 
var
List: TLinkedList<string>;
Head, Tail,Current: TLinkedListNode<string>;
Value:string;
 
begin
List := TLinkedList<string>.Create;
 
List.AddFirst('.AddFirst() adds at the head.');
List.AddLast('.AddLast() adds at the tail.');
Head := List.Find('.AddFirst() adds at the head.');
List.AddAfter(Head, '.AddAfter() adds after a specified node.');
Tail := List.Find('.AddLast() adds at the tail.');
List.AddBefore(Tail, 'Betcha can''t guess what .AddBefore() does.');
 
Writeln('Forward:');
for value in List do
Writeln(value);
 
Writeln(#10'Backward:');
 
Current:= Tail;
while Assigned(Current) do
begin
Writeln(Current.Value);
Current:= Current.Prev;
end;
 
List.Free;
Readln;
end.</lang>
 
=={{header|E}}==
478

edits