collectable
collectable copied to clipboard
Fix sorted map always using insertion order when created as mutable
Pass compare function to sorted map when calling empty using mutable overload.
Hey thanks for the PR. Not ignoring you, you just caught me in a busy period and I need to reclone the repo and get up to date. I notice there is a build failure in Travis CI... if you are so inclined, perhaps you could take a look at the build log and let me know if you can see if it something that might be a problem?
@axefrog The build errors have been resolved
@AreeseDT, what's the use case that this is solving? I see that this is pretty old now, is this still necessary? also, can you please add some UTs?
@eliranek1 When creating a mutable empty sorted map, the value of the comparator is never set. This means every mutable empty sorted map is always sorted in insertion order. The expected behavior of a mutable empty sorted map is that any items added are sorted by the provided comparator.
It would appear that this is a bug seeing as there are two function signature overloads with mutable: boolean|MutationContext and a ComparatorFn<SortedMapEntry<K, V, undefined>> parameter. The presence of the ComparatorFn<SortedMapEntry<K, V, undefined>> parameter shouldn't be ignored completely for mutable sorted maps correct?