Created
December 9, 2012 18:25
-
-
Save davidandrzej/4246368 to your computer and use it in GitHub Desktop.
Scala Seq.union behavior - come on!
This file contains hidden or 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
| scala> val x = Seq(1,2) | |
| x: Seq[Int] = List(1, 2) | |
| scala> val y = Seq(2,3) | |
| y: Seq[Int] = List(2, 3) | |
| scala> x.union(y) | |
| res0: Seq[Int] = List(1, 2, 2, 3) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah IMO
unionis pretty suggestive naming for this method which would lead me to believe it hadSet.unionsemantics. The Scala collection docs finesse this by sayingSeq.unionis multiset-union, but I guess it would surprise me especially if IntelliJ autocomplete helped me callunionon a datatype which I didn't explicitly realize to beSeq...