1.build map for key-val based on rb-tree