I am facing a problem in sorting. The format of data is:
b4 S0_c5 t 0.426544
b6 S1_c5 t 1.51049
b13 S0_c5 t 0.594502
b13 S1_c5 t 0.537496
b15 S1_c5 t 0.884126
b18 S0_c5 t 0.500933
b19 S1_c5 t 0.628472
b22 S0_c5 t 0.437718
and required result is:
S0_c5 b13 0.594502 b18 0.500933 b22 0.437718 b4 0.426544
S1_c5 b6 1.51049 b15 0.884126 b19 0.628472 b13 0.537496
the value is also in descending order. Thanks in advance.
Put the data in a
TreeList<String, List<String>>(because it’s sorted) where the second word from a sequence is the key, and the value a list of strings, then sort each list you obtain this way:Update:
E.g. to read from a file: