Skip to content

Modern OrderedMap Remove

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

Home › OrderedMap › OrderedMap and OrderedSet › OrderedMap.Remove

OrderedMap.Remove

Removes a key and its value; returns true if the key was there.

Syntax

Remove( k ) as boolean

Examples

#import "std/containers"
using containers

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

print ages.Remove( "ada" )        '' true
print ages.Remove( "ada" )        '' false -- already gone
print ages.Count                  '' 1

'' The tree rebalances on removal -- at most three rotations, which is
'' why a red-black tree was chosen over AVL

Library: OrderedMap and OrderedSet
Category: OrderedMap
Documented under: Members

Clone this wiki locally