val a = List((2,5,1),(3,8,4), (5,4,3) ,(9,1,2))
I want the output to be a different list, which is in sorted order based on the middle element of each tuple in the list, and the first and third order of the tuples should not change. This is like replacing a second tuple.
Expected Answer:
List((2,1,1), (3,4,4) , (5,5,3), (9,8,2))
source
share