BalancedTree allows key-value mapping with arbitrary keys, as long as they can be ordered. By default, Reflect.compare is used in the compare method, which can be overridden in subclasses.

Operations have a logarithmic average and worst-case cost.

Iteration over keys and values, using keys and iterator respectively, are in-order.

Constructor

new()

Creates a new BalancedTree, which is initially empty.

Methods

get(key:K):Null<V>

Returns the value key is bound to.

If key is not bound to any value, null is returned.

If key is null, the result is unspecified.

keys():Iterator<K>

Iterates over the keys of this BalancedTree.

This operation is performed in-order.

set(key:K, value:V):Void

Binds key to value.

If key is already bound to a value, that binding disappears.

If key is null, the result is unspecified.