value · System

LinkedListIterator<T>

public value LinkedListIterator<T>

The values of a linked list, from the first.

Kind
value
Namespace
System
Assembly
System.Core
Access
public
Source file
LinkedList.ant

Type parameters

NameConstraints
Tany type

Constructors

new(LinkedListNode<T>? first)
#

Properties

T Current { get; }
#

read-only

Methods

Next() : bool
#

Private and internal members (2)

LinkedListNode<T>? next
#

private

LinkedListNode<T>? current
#

private

Source

LinkedListIterator<T> as Antril, decompiled from its Larva HIR.

System.LinkedListIterator.ant
// System.LinkedListIterator — System.Core (decompiled from Larva HIR)

into namespace System
{
	/// The values of a linked list, from the first.
	public value LinkedListIterator<T>
	{
		LinkedListNode<T>? next;
		LinkedListNode<T>? current;

		public:
			new(LinkedListNode<T>? first)
			{
				next = first;
			}

			Next() : bool
			{
				if (next is not LinkedListNode<T> node)
					return false;
				current = node;
				next = node.Next;
				return true;
			}

			T Current
			{
				get
				{
					if (current is LinkedListNode<T> node)
						return node.Value;
					throw new InvalidOperationError("the iterator is not on a value");
				}
			}
	}
}
Esc