Preserve the order of ListBuffer after GroupBy

I have a Listbuffer which is already sorted.When i use GroupBy on sorted Listbuffer , it is not retaining the sorted order.Can anyone help me in solving this.

Thank you

Hi @ScalaDeveloper. This forum is not meant for general Scala questions. I suggest posting this on https://users.scala-lang.org/ instead.