Can anybody optimize following statement in Scala:
// maybe large val someArray = Array(9, 1, 6, 2, 1, 9, 4, 5, 1, 6, 5, 0, 6) // output a sorted list whic
I haven't measured, but I'm with Duncan, sort in place then use something like:
util.Sorting.quickSort(array) array.foldRight(List.empty[Int]){ case (a, b) => if (!b.isEmpty && b(0) == a) b else a :: b }
In theory this should be pretty efficient.