我用 Java 编写了一个 NaturalComparator 类/对象并将其重写为 Scala: https ://gist.github.com/319827#file_natural_comparator.scala
但是,我想知道为什么我不需要在 Scala 版本中使用 @SuppressWarnings("unchecked") 。(我编译它fsc -deprecation -unchecked NaturalComparator.scala
。)
- Scala 是否强大到足以识别转换是否正常?
- Scala 编译是否假设我知道我在使用泛型时在做什么
.asInftanceOf[...]
?