object ScalaTest {

def sortByFunc(input: (String,(Double, Double))): Double = {
return input._2._1 / input._2._2
}

def main(args: Array[String]): Unit = {
var tmpArray = Array[(String, (Double, Double))]()
tmpArray = tmpArray :+ ("guotong1", (1.0, 2.0))
tmpArray = tmpArray :+ ("guotong2", (1.0, 3.0))
tmpArray = tmpArray :+ ("guotong3", (1.0, 4.0))
tmpArray = tmpArray :+ ("guotong4", (1.0, 5.0))

val sortedArray = tmpArray.sortBy(sortByFunc)
println(sortedArray.last.toString())
//或者
val sortedArray2 = tmpArray.sortBy(one => {
one._2._1 / one._2._2
})
println(sortedArray2.last.toString())
}

}