gitee.com/quant1x/gox@v1.21.2/concurrent/treemap_test.go (about)

     1  package concurrent
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestTreeMap(t *testing.T) {
     9  	treemap := NewTreeMap[string, int]()
    10  	treemap.Put("a", 10)
    11  	treemap.Put("1a", 12)
    12  	v, ok := treemap.Get("a")
    13  	fmt.Println(v, ok)
    14  	v, ok = treemap.Get("a1")
    15  	fmt.Println(v, ok)
    16  
    17  	treemap.Each(func(key string, value int) {
    18  		fmt.Println(key, value)
    19  	})
    20  }