The Artima Developer Community


Errata for Programming in Scala, 2nd Edition
Chapter 24: The Scala Collections API
Return to errata index.

Page 505 (PDF page 540):
The description of copyToArray should say "Copies at most len elements of
xs to arr," instead of "copies at most len elements of arr." It should
also specify whether the start index is for the array or for the
collection being copied from.
Page 509 (PDF page 544):
Table that summarizes operations of Iterable trait:

xs.zipWithIndex - An iterable of pairs of elements from xs with
their indicies (should've spelled "indices")
Page 514 (PDF page 549):
Since the expression is written as "xs(i) = x" the following sentence
"Changes the element of xs at index i to y." should be "Changes the
element of xs at index i to x.".
Page 521 (PDF page 556):
Missing preposition "in" in the first sentence of the "Sorted sets"
chapter:

A SortedSet is a set where, no matter what order elements 
                                      ^
were added to the set, the elements are traversed in sorted order.
Page 527 (PDF page 562):
The first sentence on the page contains one extra word "have":

... but it would have have taken more code to do so.
                      ^
Page 515 (PDF page 567):
"Because if this" -> "Because of this"

[Fixed.]
Page 541 (PDF page 576):
It's - > its
Page 542 (PDF page 577):
In the explanation of putIfAbsent function, key/value binding should be
"k -> v" not "k -> m".
Page 552 (PDF page 587):
In the last paragraph of Equality subsection, the array name should be
buf, not xs:
...because the hash code of the array *xs* has changed... -> ...because
the hash code of the array "buf" has changed...
...than the one in which *xs* was stored. -> ...than the one in which
"buf" was stored.
Page 554 (PDF page 589):
In the listing that shows view operations one by one, it is listed:

val vv = v.view
vv: scala.collection.SeqView[Int,Vector[Int]] =
SeqView(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

But, in the interpreter, the same expression gives lazy result:

val vv = v.view
vv: scala.collection.SeqView[Int,Vector[Int]] = 
SeqView(...)
Page 539 (PDF page 591):
"..and do not have a ClassManifest to provide it at run-time."

The 'it' seems too much, and I cannot figure out where it would point.

-> "..a ClassManifest to provide at run-time."

[Agreed. I changed "it" to "the element type". (Also we changed
ClassManifest to ClassTag.)]
Page 543 (PDF page 595):
"Scala arrays offer much more (than) their Java analogues." 

"than" is missing.

[Fixed.]
Page 564 (PDF page 599):
The 'start' arguments to Iterator's addString and mkString are typeset in
the books regular serifed font and should instead be monospaced.
Page 566 (PDF page 601):
Third paragraph, 6th line: "...or whether it is *an* trait such as..."
Page 571 (PDF page 606):
"You've now seen how to use Scala's collection in great detail.":
"collection" -> "collections" or "collection" -> "collection library"
Page 562 (PDF page 614):
For "it take n":

"An iterator returning of the first n..."
->
"An iterator returning the first n..."

[Fixed.]
Page 565 (PDF page 617):
Add Vector to the index.

[Done]

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2021 Artima, Inc. All rights reserved.