elliotchance / orderedmap

🔃 An ordered map in Go with amortized O(1) for Set, Get, Delete and Len.
MIT License
817 stars 62 forks source link

Nested ordered maps #36

Closed retr0h closed 8 months ago

retr0h commented 8 months ago

Was looking to implement something similar in orderedmap

schematicMap := make(map[int]map[int]string)

Where m := orderedmap.NewOrderedMap[int, any]() is the key, and mm := orderedmap.NewOrderedMap[int, any]() is re-created in a loop as the value.

However, attempting to set the map with a value of another map, only returns the Set's bool success.

m.Set(yPos, mm.Set(xPos, s.Text()))
0 true
1 true
2 true
3 true
4 true
5 true
6 true
7 true
8 true
9 true