value · System

LinkedListIterator<T>

public value LinkedListIterator<T>

The values of a linked list, from the first.

Tipo
value
Espacio de nombres
System
Ensamblado
System.Core
Acceso
public
Archivo fuente
LinkedList.ant

Parámetros de tipo

NombreRestricciones
Tcualquier tipo

Constructores

new(LinkedListNode<T>? first)
#

Propiedades

T Current { get; }
#

read-only

Métodos

Next() : bool
#

Miembros privados e internos (2)

LinkedListNode<T>? next
#

private

LinkedListNode<T>? current
#

private

Código fuente

LinkedListIterator<T> en Antril, descompilado a partir de su 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