by Ricardo Fernández Serrata
Improved version of Patrick Corgan's flow. Sorts the entries of a dictionary by keys or values.
For performance, indexOf is only called once per iteration.
To avoid bugs, Array Set tmp_1 (at the value-sorter) is set to null instead of -1.
The dictionary is modified in-place by the key-sorter.
The value-sorter makes a reference copy from tmp_0 to D, which is faster and more memory-friendly than shallow and/or deep copy.
Conversion types are preserved.
Rate and review within the app in the Community section.