Home > front end >  Key value and the value of the Dictionary twice sort of problem
Key value and the value of the Dictionary twice sort of problem

Time:12-11

For example:
{" a ", 2}, {" b ", 2}, {" a ", 3}, {" c ", 1}, {" a ", 1}, {" b ", 1}
Use first Sort method on the key value sequence, to:
{" a ", 2}, {" a ", 3}, {" a ", 1},
{" b ", 2}, {" b ", 1},
{" c ", 1}
This step is very simple,
Then without destroying the key value sequence of value under the condition of sorting, become
{" a ", 1}, {" a ", 2}, {" a ", 3},
{" b ", 1}, {" b ", 2},
{" c ", 1}
This step should be how to do,
Can now think of the Dictionary, according to the same key value into multiple again sort respectively, finally together
But the implementation method is too clumsy, performance is poor, also want to ask is there a better way,
  • Related