How to use rbtree? Is there a sample

class RBTree<X, Y>(compareTo : (X, X) → O.Order)

How to initialize an object?

import RBTree "mo:base/RBTree";
import Nat "mo:base/Nat";
var t = RBTree.RBTree(Nat.compare);
2 Likes

You can generally find example usage for base library modules on the repo too: https://github.com/dfinity/motoko-base/tree/master/test

1 Like