Skip to content

Subtly bad code example for Scala breakOut #2064

@SethTisue

Description

@SethTisue

report from Bart Jenkins:

I was perusing how to use “breakOut” in Scala at:

https://docs.scala-lang.org/tutorials/FAQ/breakout.html

And wanted to point out that the example given uses a list of two strings, “London” and “France” and then uses a map function to convert that ultimately into a Map[Int, String]. The problem is in the example strings: They are both length of 6 and so you will wind up with just ONE entry in the map because London gets overwritten by France. Was this example produced by a Frenchman who wanted to get a dig into the Brits? Looks like a conspiracy to me!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions