Skip to content

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

[Source]

Iterate over the values in a List.

class ref ListValues[A: A, N: ListNode[A] #read] is
  Iterator[N->A] ref

Implements


Constructors

create

[Source]

Build the iterator over values.

reverse of false iterates forward, while reverse of true iterates in reverse.

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

Parameters

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

Returns


Public Functions

has_next

[Source]

Indicates whether there are any values remaining in the iterator.

fun box has_next()
: Bool val

Returns


next

[Source]

Return the next node in the iterator, advancing the iterator by one element.

Order of return is determined by reverse argument during creation.

fun ref next()
: N->A ?

Returns

  • N->A ?