Could we get a `TreeMap` in the standard library?
# stdlib
c
Could we get a
TreeMap
in the standard library?
2
e
btw TreeMap/TreeSet potentially break the rules of collections a bit… https://pl.kotl.in/W9XwYAVQn
I do agree that it would be nice to have a sorted collection and association nonetheless. maybe with b-trees instead of rbtrees like java…
c
Is the problem just that
equals
in the Java stdlib doesn't behave the same as other
Set
collections?
e
more that
contains
is based on the comparator, which makes sense (otherwise it would be inconsistent with `get`/`put`/etc.), but breaks equality with collections which don't have the same equivalence classes on their items
c
Is that a common problem? I knew about it, but I've never had any problems because of that
e
the general case is explicitly called out in the second paragraph of https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html