Skip to content

Modern OrderedMap OrderedMapPairView

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › OrderedMap › OrderedMap › OrderedMapPairView

OrderedMapPairView

Holds the view that OrderedMap.Pairs returns, for for each (k, v) to walk.

Syntax

OrderedMapPairView( of TK, TV )

Notes

  • A view holding a pointer to the map, for for each to consume. It copies nothing.
  • In ascending key order, which is the difference from the Map equivalents.
  • An in-order walk of the tree, so it is O(n) overall and O(log n) in stack.

Examples

#import "std/containers"
using containers

dim ages as OrderedMap( of ustring, integer )
ages.Put( "bob", 41 )
ages.Put( "ada", 36 )

for each kv in ages
    print kv.key & " " & kv.value             '' ada 36 / bob 41
next

for each (who, age) in ages.Pairs( )
    print who                '' ada / bob
next

Library: OrderedMap
Category: OrderedMap
Documented under: Members

Clone this wiki locally