I've written a NaturalComparator class/object in Java and rewritten it into Scala: https://gist.github.com/319827#file_natural_comparator.scala
However, I wonder why I don't need to @SuppressWarnings("unchecked") in the Scala version. (I compile it by fsc -deprecation -unchecked NaturalComparator.scala
.)
- Is Scala powerful enough to recognize that the conversion is OK?
- Does Scala compiles assume that I know what I'm doing when I'm using generics in
.asInftanceOf[...]
?
x instanceof T
in Java). – v6ak Feb 26 '11 at 19:05