The Artima Developer Community


Errata for Programming in Scala, Third Edition
Chapter 17: Working with Other Collections
Return to errata index.

Page 359 (PDF page 397):
Following the sequence of code in the book, when I enter:
val immu = Map.empty ++ muta

the response is:
immu: scala.collection.mutable.Map[String,Int] = Map(ii -> 2, i -> 1)

In order to get an immutable Map, I need to make the following changes:
import scala.collection.immutable
val immu = immutable.Map.empty ++ muta
---
Good point. Will add something to clarify need to restart the REPL after
that import of scala.collection.mutable.Map. Tnx.

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.