Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Last active August 29, 2015 13:59
Show Gist options
  • Save gakuzzzz/10814618 to your computer and use it in GitHub Desktop.
Save gakuzzzz/10814618 to your computer and use it in GitHub Desktop.
Is Stream#addString correct?
scala> Iterator.iterate(0)(_ + 1).take(10).addString(new StringBuilder, ",")
res7: StringBuilder = 0,1,2,3,4,5,6,7,8,9
scala> Stream.iterate(0)(_ + 1).take(10).addString(new StringBuilder, ",")
res8: StringBuilder = 0,?
scala> Iterator.iterate(0)(_ + 1).take(10).toString
res9: String = non-empty iterator
scala> Stream.iterate(0)(_ + 1).take(10).toString
res10: String = Stream(0, ?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment