我可以比较方法工作到Tuple9如下:
import scala.math.Ordered.orderingToOrdered
(1,2,"ab",4,5,6.0,7l,"de",1.0) compare (1,2,"ab",4,5,6.0,7l,"de",1.0)
但是使用Tuple10我得到了编译错误:
import scala.math.Ordered.orderingToOrdered
(1,2,"ab",4,5,6.0,7l,"de",1.0,2) compare (1,2,"ab",4,5,6.0,7l,"de",1.0,2) // >> compile error: value compare is not a member of (Int, Int, String, Int, Int, Double, Long, String, Double, Int)
我尝试了替代方式,但这也给出了隐含错误:
implicitly[Ordering[Tuple10[Int, Int, String, Int, Int, Double, Long, String, Double, Double]]].compare((1,2,"ab",4,5,6.0,7l,"de",1.0,4), (1,2,"ab",4,5,6.0,7l,"de",1.0,4))
compiler error:
No implicit Ordering defined for (Int, Int, String, Int, Int, Double, Long, String, Double, Double).
not enough arguments for method implicitly: (implicit e: Ordering[(Int, Int, String, Int, Int, Double, Long, String, Double, Double)])Ordering[(Int, Int, String, Int, Int, Double, Long, String, Double, Double)]. Unspecified value parameter e.
看起来Ordering只定义为Tuple9。如果我错了,请纠正我。