I'm trying to sort the list with collection of string in scala, whose result should be identical to the C# list result. But for the following data, C# returning the result in different order and scala returning the result in different order. Could anyone please tell me who to make the result for both the language identical for any type of string?
C# Code:
List<String> list = new List<String>();
list.Add("bmw_sip");
list.Add("bmw_mnt");
list.Add("bmw1");
list.Add("bmw");
list.Sort();
foreach (String data in list)
{
Console.Write(data+" ");
}
Output:
bmw bmw_mnt bmw_sip bmw1
Scala Code:
var list = List("bmw_sip", "bmw_mnt", "bmw1", "bmw")
list.sorted
Output:
List[String] = List(bmw, bmw1, bmw_mnt, bmw_sip)