Skip to content

ListNodes[A: A, N: ListNode[A] #read]

[Source]

Iterate over the nodes in a list.

class ref ListNodes[A: A, N: ListNode[A] #read] is
  Iterator[N] ref

Implements


Constructors

create

[Source]

Keep the next list node to be examined.

new ref create(
  head: (N | None val),
  reverse: Bool val = false)
: ListNodes[A, N] ref^

Parameters

  • head: (N | None val)
  • reverse: Bool val = false

Returns


Public Functions

has_next

[Source]

If we have a list node, we have more values.

fun box has_next()
: Bool val

Returns


next

[Source]

Get the list node and replace it with the next one.

fun ref next()
: N ?

Returns

  • N ?