Last active
January 17, 2017 07:00
-
-
Save fommil/b4586521a1578f8bf272cd7b68f24003 to your computer and use it in GitHub Desktop.
puzzler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.immutable._ | |
case class Foo(s: String) | |
// what do you expect? | |
implicit val ordering = Ordering[String] | |
val tree = TreeMap.empty ++ (1 to 100).map { i => Foo(i.toString) -> i } | |
tree.getClass | |
// compared to | |
implicit val ordering = new Ordering[Foo] { def compare(a: Foo, b: Foo): Int = 0 } | |
val tree = TreeMap.empty ++ (1 to 100).map { i => Foo(i.toString) -> i } | |
tree.getClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like this a little better as "what is the type of
tree
" instead of "what doesgetClass
say" since it's really a types problem not a runtime problem