I'm new to Scala, does Scala support a fixed length SortedMap?
What I have in mind is a map that does the following:
- Takes a max_size parameter upon creation
- Upon an add, checks if there are already max_size elements
- If there is, remove the smallest key and its value first (key's gonna be an Int)
- Then adds the key and value to the map.
Strictly speaking, I don't need the map to be sorted, but it seems necessary/available if we're removing the smallest key
I wanted to ask before I started rolling my own. Also I will be running this under Samza, which I believe is single threaded and so concurrency won't be a concern.
I'm on scala 2.10