Appendix D. List of Scala tips in this book

 

This book is not intended to teach you Scala, but rather provides Scala tips along the way to help you along, under the assumptions that Scala may not be your first and most familiar language and that you may not have seen all the requisite Scala tricks before. For books on learning Scala, see appendix C.

Below is a list of the Scala tips sprinkled throughout the book:

Chapter 2

  • Underscores mean different things in different places... 27

Chapter 4

  • The object keyword ... 65
  • The apply() method ... 65
  • Type inference of return values ... 68
  • Type parameter for generics cannot be inferred ... 70
  • The Option[] class ... 72
  • Multiple imports on same line... 76
  • Backticks to escape reserved words... 78
  • Pasting blocks of code into the REPL... 79
  • Multiple parameter lists ... 87
  • Named parameters ... 88

Chapter 5

  • Optional parentheses on function invocation... 98
  • Regex and “raw” strings ... 104
  • For comprehensions... 106

Chapter 6

  • List operator +: for appending ... 114
  • The type keyword ... 116
  • ClassTag... 119

Chapter 7

  • Multiple return values 131
  • Dot product idiom using zip(), map(), and reduce()... 132
  • HashMap initialization using -> ... 161

Chapter 8

  • Formatted output using "${myVar}"... 172
sitemap