On the bottom of the copyright page (facing the first page of the table of contents), look for the very last line in the copyright page. It will look like 1 16
, 2 17
, and so on. The first number is the printing number.
In the errata below, we indicate the printing in which the error has been fixed inside square brackets such as [4].
For example, suppose you have the fourth printing. Then you can ignore all reports that are prefixed with [2], [3] or [4]. But you would want to pay attention to all reports that are prefixed with [5] or higher or that have no bracketed prefix at all.
scala.
” to “If a package starts with scala.
”def apply(n: Int): Char
to def apply(i: Int): Char
("Bonjour".sorted)(3)
to: “You can use another variable:”
val result = "Bonjour".sorted result(3)
import scala.io
to import scala.io._
JavaConversions
to JavaConverters
0 until a.length by -1
to a.length -1 to 0 by -1
, both above and in the tip.scala.collection.JavaConversions
. Then
you can use Scala buffers in your code, and they automatically get wrapped into
Java lists when calling a Java method.” to “Instead,
import the conversion methods in scala.collection.JavaConverters
. Then
you can call the asJava
method to convert any sequence (such as a Scala buffer) into a Java list.”import scala.collection.JavaConversions.bufferAsJavaList
to import scala.collection.JavaConverters._
and val pb = new ProcessBuilder(command)
to val pb = new ProcessBuilder(command.asJava)
Buffer
” to “you can convert it into a Buffer
”import scala.collection.JavaConversions.asScalaBuffer
to import scala.collection.JavaConverters._
and val cmd : Buffer[String] = pb.command()
to val cmd : Buffer[String] = pb.command().asScala
scores1.get("Zelda")
to scores1("Zelda")
and scores2.get("Zelda")
to scores2("Zelda")
import scala.collection.JavaConversions.mapAsScalaMap
to import scala.collection.JavaConverters._
, change “Then trigger the conversion by specifying the Scala map type:” to “Then use the asScala
method to turn the Java map into a Scala map:”, and change
val scores: scala.collection.mutable.Map[String, Int] = new java.util.TreeMap[String, Int]to
val ids = java.time.ZoneId.SHORT_IDS.asScala
// Yields a scala.collection.mutable.Map[String, String]
import scala.collection.JavaConversions.propertiesAsScalaMap val props: scala.collection.Map[String, String] = System.getProperties()to
val props = System.getProperties.asScala // Yields aMap[String, String]
, not aMap[Object, Object]
import scala.collection.JavaConversions.mapAsJavaMap import java.awt.font.TextAttribute._ // Import keys for map below val attrs = Map(FAMILY -> "Serif", SIZE -> 12) // A Scala map val font = new java.awt.Font(attrs) // Expects a Java mapto
import java.awt.font.TextAttribute._ // Import keys for map below val attrs = Map(FAMILY -> "Serif", SIZE -> 12) // A Scala map val font = new java.awt.Font(attrs.asJava) // Expects a Java map
f"$time04d"
to f"$time%04d"
MilTime lunch
to val lunch
val b = t1
to val b = t2
Scala.io.readInt()
to StdIn.readInt()
String dirname
to val dirname
abstract override def log(msg: String) { ... }
to abstract override def log(msg: String) {
1 .->(10)
to 1.->(10)
val listener = (event: ActionListener) => println(counter)
to val listener = (event: ActionEvent) => println(counter)
SortedSeq
to SortedSet
c.reduceLeft(op)
” to “The call coll.reduceLeft(op)
”words(5) // Aachen
to words(4) // Aachen
JavaConversions
object” to “The JavaConverters
object” and remove “Give the target value an explicit type to trigger the conversion.”import scala.collection.JavaConversions._ val props: scala.collection.mutable.Map[String, String] = System.getProperties()to
import scala.collection.JavaConverters._ val props = System.getProperties.asScala
import scala.collection.JavaConversions.propertiesAsScalaMap
” to:val propsMap = mapAsScalaMap(System.getProperties)
// Yields a Map[Object, Object]
val props: scala.collection.mutable.Map[String, String] = System.getProperties()
to val props = System.getProperties.asScala
import scala.collection.JavaConversions.propertiesAsScalaMap
to
import scala.collection.JavaConverters._
and change System.getProperties()
to System.getProperties.asScala
(3x)TypeAnnotation
trait” to “A type annotation must extend the TypeConstraint
trait”Unparced
to Unparsed
Future[T] result = Future.firstCompletedOf(futures)
to val result = Future.firstCompletedOf(futures)
for (n1 <- Future { Thread.sleep(1000) ; 2 }
T => Future[U]
” to “produces a function T => Future[V]
”/
at the end of the second notee
” to “the value is now simply expr
”JavaConversions
to JavaConverters
Thanks to Prashanth Babu, David Bendit, Nathan Brown, Michael Josephson, Mokhtar Khorshid, Artem Koval, Alex Levin, David Lott, M. Henry, Paul Nelson, Etienne Neveu, Maria Pacana, Etienne Richard, Juan Ignacio Santos Florido, Nico Serfontein, Bradley Smith, Marcel Stucki, Clark Verbrugg, Wei Zheng, and (your name might go here) for their bug reports and suggestions!
Please use this form to report any bugs that you find. Please check the list of known bugs first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!