Index

Symbols and Numbers

  1. - (minus sign)

    1. in identifiers, 150

    2. operator:

      1. arithmetic, 7

      2. for collections, 191192

      3. for maps, 54

      4. for type parameters, 269

      5. for types, 323

      6. left-associative, 154

      7. precedence of, 153

      8. unary (negation), 13, 152

  2. -- operator

    1. for collections, 191192

    2. for sets, 190

    3. not used for arithmetic decrements, 7

  3. -= operator

    1. arithmetic, 7

    2. for collections, 191192

    3. for maps, 53

  4. --= operator, 191192

  5. _ (underscore)

    1. for function parameters, 172

    2. in case clauses, 34, 210211, 214215

    3. in identifiers, 150

    4. in imports, 91

    5. in tuples, 58

  6. _*, for arrays, 214

  7. _=, in setter methods, 66

  8. _1, _2, _3 methods (tuples), 57, 220

  9. , (comma), in identifiers, 150

  10. ; (semicolon)

    1. after statements, 5, 1820

    2. in identifiers, 150

    3. inside loops, 26

  11. : (colon)

    1. followed by annotations, 233

    2. in case clauses, 212213

    3. in class definitions, 64

    4. in identifiers, 150

    5. in operators, 153154

    6. in REPL commands, 4

    7. in type parameters, 266

  12. :: operator, 154

    1. for collections, 192

    2. for lists, 188189, 191192, 319321

    3. in case clauses, 215, 225

  13. :::, :+ operators, 191192

  14. :+= operator, 191

  15. ! (exclamation mark)

    1. in identifiers, 150

    2. operator, 122123, 152153

  16. !! operator, in shell scripts, 122

  17. != operator, 153

    1. for types, 323

  18. ? (question mark), in identifiers, 150

  19. ?: operator, 18

  20. ??? method, 108

  21. / (slash)

    1. in identifiers, 150

    2. operator, 7, 153

  22. /% method (BigInt), 7, 217

  23. . (period), in identifiers, 150

  24. ' (backquote)

    1. in case clauses, 212

    2. in class definitions, 64

    3. in identifiers, 90, 150

  25. ^ (caret)

    1. in identifiers, 150

    2. in Pascal, 163

    3. operator, 7, 153

  26. ~ (tilde)

    1. in identifiers, 150

    2. operator, 152

  27. ' (single quote), " (double quote), in identifiers, 150

  28. """, in regular expressions, 124

  29. () (parentheses)

    1. as value of Unit, 1922

    2. for annotations, 233

    3. for apply method, 910

    4. for array elements, 40

    5. for curried parameters, 177

    6. for functions, 3132, 170172, 178

    7. for maps, 52

    8. for primary constructors, 70

    9. for tuples, 57

    10. in case clauses, 215, 219

    11. in identifiers, 150

    12. in method declarations, 8, 65, 67

    13. in regular expressions, 126

  30. [] (square brackets)

    1. for arrays, 40

    2. for methods in traits, 135

    3. for type parameters, 13, 264

    4. in identifiers, 150

    5. with qualifiers, 6869, 89

  31. {} (braces)

    1. for block expressions, 2122

    2. for function arguments, 171

    3. for structural types, 281

    4. in class definitions, 64

    5. in exports, 93

    6. in formatted strings, 22

    7. in identifiers, 150

    8. in imports, 91

    9. in pattern matching, 224225

    10. in REPL, 19

  32. @ (at)

    1. in annotations, 232

    2. in case clauses, 221

    3. in identifiers, 150

  33. $ (dollar sign), in formatted strings, 22

  34. * (asterisk)

    1. in function parameters, 30

    2. in identifiers, 90, 150

    3. in imports, 90, 248

    4. in Java, 8

    5. operator, 7, 153, 307

  35. *: operator, 188

  36. **

    1. in Fortran, 163

    2. in identifiers, 150

  37. (backslash), in identifiers, 150

  38. & (ampersand)

    1. in identifiers, 150

    2. operator:

      1. arithmetic, 7

      2. for collections, 191192

      3. for sets, 190

      4. for types, 278279, 282

      5. precedence of, 153

  39. &~ operator, 190191

  40. # (number sign)

    1. for type projections, 74, 288

    2. in identifiers, 150

  41. #:: operator, 203

  42. #&&, #<, #>, #>>, #|, #|| operators (in shell scripts), 123

  43. % (percent sign)

    1. in identifiers, 150

    2. operator, 7, 153

  44. + (plus sign)

    1. in identifiers, 150

    2. operator:

      1. arithmetic, 7

      2. for collections, 191192

      3. for maps, 53

      4. for type parameters, 269

      5. for types, 323

      6. precedence of, 153

      7. unary, 152

  45. +: operator, 154, 191192

  46. ++ operator

    1. for collections, 191192

    2. for sets, 190

    3. for tuples, 58

    4. not used for arithmetic increments, 7

  47. ++:, ++=:, +=: operators, 191192

  48. ++= operator

    1. for array buffers, 40

    2. for collections, 191192

    3. for maps, 53

  49. += operator

    1. arithmetic, 7

    2. assignment, 153

    3. for array buffers, 40

    4. for collections, 152, 191192

  50. < (left angle bracket)

    1. in identifiers, 150

    2. operator, 153

  51. <- operator, 24, 26, 218219

  52. ← identifier, 150

  53. <: operator, 265273, 289

  54. <:< operator, 267, 311

  55. << operator, 7

  56. <= operator, 153

  57. = (equal sign)

    1. in identifiers, 150

    2. operator, 53, 153

  58. = := operator, 267, 311312

    1. for types, 323

  59. == operator, 153

    1. attempting to override, 110

    2. for collections, 185

    3. for types, 110, 323

    4. with incomporable objests, 110

  60. ===, =/= operators, 153

  61. => operator

    1. for functions, 178

    2. for self types, 143144

    3. in case clauses, 210

  62. identifier, 150

  63. > (right angle bracket)

    1. in identifiers, 150

    2. operator, 153

  64. -> operator, 52, 153

  65. >: operator, 266267

  66. >= operator, 153

  67. >>, >>> operators, 7

  68. | (vertical bar)

    1. in case clauses, 210

    2. in identifiers, 150

    3. operator:

      1. arithmetic, 7

      2. for sets, 190191

      3. for types, 277278

      4. precedence of, 153

  69. √ (square root), 150

  70. Images (alarm clock emoji), 64

  71. 0 value, 64

  72. 0x prefix, in hexadecimal literals, 5

A

  1. abstract keyword, 101102, 131, 136, 299

  2. abstract types, 286287

    1. bounds for, 289290

    2. made concrete in subclass, 281, 286

    3. naming, 290

    4. vs. type parameters, 287

  3. addString method

    1. of Iterable, 194

    2. of Iterator, 202

  4. adhocExtensions object, 104

  5. after method, 125

  6. aggregate method

    1. of Iterable, 193

    2. of Iterator, 202

  7. algebraic data types, 224

  8. aliases

    1. for this, 144

    2. for types, 186, 279281

  9. andThen method

    1. of Function1, 177

    2. of Future trait, 254

  10. Annotation trait, 239

    1. annotations, 231240

    2. @beanGetter, @beanSetter, 240

    3. @BeanProperty, 66, 72

    4. @BooleanBeanProperty, 234

    5. @deprecated, 82, 238, 240

    6. @deprecatedName, 45, 238

    7. @experimental, 238

    8. @field, 240

    9. @getter, 240

    10. @JsonbProperty, 233, 240

    11. @main, 31, 81

    12. @native, 236

    13. @nowarn, 239

    14. @Overrides, 99

    15. @param, 240

    16. @SerialVersionUID, 121, 234

    17. @setter, 240

    18. @tailrec, 237

    19. @targetName, 151

    20. @threadUnsafe, 238

    21. @throws, 235

    22. @transient, 235

    23. @unchecked, 238239

    24. @uncheckedVariance, 239

    25. @varargs, 235

    26. @volatile, 236

    27. arguments of, 233

    28. for compiler optimizations, 236238

    29. for errors and warnings, 238239

    30. implementing, 239240

    31. in Java, 232236

    32. meta-annotations for, 240

    33. order of, 233

  11. anonymous functions, 170172

  12. Any class, 107, 109

    1. asInstanceOf method, 99, 107, 214

    2. isInstanceOf method, 99, 107

  13. AnyRef class, 107, 213

    1. == method, 110

    2. eq, equals methods, 109

    3. notify, notifyAll, synchronized, wait methods, 107

  14. AnyVal class, 106, 111, 213

  15. append method

    1. of Appendable, 281

    2. of StringBuilder, 58

    3. vs. intersection types, 282

  16. Appendable interface (Java), 132, 281282

  17. application objects, 81

  18. apply method, 910, 80, 155, 156, 159

    1. of Array, 10, 80

    2. of BigInt, 10

    3. of case classes, 219

    4. of collections, 185

    5. of Future object, 251, 259

    6. of PartialFunction, 224

    7. of Process, 123

    8. of StringOps, 9

  19. applyDynamic method

    1. of Dynamic, 160161

    2. of Selectable, 163

  20. applyDynamicNamed method

    1. of Dynamic, 160161

    2. of DynamicProps, 161

  21. array buffers, 4041

    1. adding/removing elements of, 4041

    2. appending collections to, 40

    3. converting to arrays, 41

    4. displaying contents of, 44

    5. empty, 40

    6. largest/smallest elements in, 44

    7. sorting, 44

    8. transforming, 4243

    9. traversing, 4142

  22. Array class, 3940, 267

    1. apply method, 80

    2. corresponds method, 177

    3. mkString method, 44

    4. ofDim method, 46

    5. sortInPlace method, 44

    6. toBuffer method, 41

  23. Array companion object, 10, 216

  24. ArrayBuffer class, 4041, 184

    1. max, min, mkString methods, 44

    2. mutable, 187

    3. serializing, 122

    4. sorted, sortWith methods, 44

    5. toArray method, 41

  25. ArrayList class (Java), 40, 47, 185

  26. ArrayOps class, 45

  27. arrays, 3948

    1. converting to array buffers, 41

    2. displaying contents of, 44

    3. fixed-length, 3940

    4. function call syntax for, 155

    5. generic, 267

    6. immutable, 213, 270

    7. interoperating with Java, 4748

    8. invariant, 270

    9. largest/smallest elements in, 44

    10. multidimensional, 4647

    11. pattern matching for, 214

    12. ragged, 47

    13. sorting, 44

    14. transforming, 4243

    15. traversing, 4142

    16. vs. lists, 185

  28. Arrays class (Java), 47

  29. ArraySeq class, 45

  30. ArrayStoreException, 270

  31. as keyword, 91

  32. ASCII characters, 150

  33. asInstanceOf method (Any), 99, 107, 214

  34. asJava method (CollectionConverters), 47, 55

  35. asJavaXxx, asScalaXxx functions (CollectionConverters), 205

  36. asScala method (CollectionConverters), 48, 55, 204, 218

  37. assignments, 2122, 153

    1. no chaining of, 22

    2. precedence of, 153

    3. right-associative, 154, 191

    4. value of, 2122

  38. asynchronous APIs, 257

  39. auto tupling, 58

  40. AutoCloseable interface (Java), 132

  41. automatic conversions. See implicit conversions

  42. Await object, 248

B

  1. bash shell, 123

  2. @beanGetter, @beanSetter annotations, 240

  3. @BeanProperty annotation, 66

    1. generated methods for, 72

  4. before method, 125

  5. BigDecimal class, 6, 8

  6. BigInt class, 69

    1. /% method, 7, 217

    2. pow method, 163

    3. unary_- method, 13

  7. BigInt companion object

    1. apply method, 10

    2. probablePrime method, 9

  8. binary files, reading, 120

  9. binary functions, 174, 197

  10. binary operators, 152155

  11. binary trees, 54

  12. BitSet class, 190, 194

  13. blocking calls, 248

  14. blocking keyword, 258

  15. blocks, 2122

  16. Boolean type, 5

    1. reading, 23

  17. @BooleanBeanProperty annotation, 234

  18. Breaks object, break method, 25

  19. Buffer class, 334

  20. buffered method

    1. of BufferedIterator, 202

    2. of Source, 119

  21. BufferedInputStream class (Java), 146

  22. BufferedIterator trait, 202

  23. Byte type, 5

    1. arrays of, 120

    2. reading, 23

C

  1. C++ programming language

    1. ?: operator in, 18

    2. arrays in, 40

    3. assignments in, 22

    4. construction order in, 106

    5. constructors in, 69

    6. functions in, 27

    7. implicit conversions in, 307

    8. linked lists in, 188

    9. loops in, 23, 42

    10. methods in, 78, 105, 236

    11. multiple inheritance in, 130

    12. namespaces in, 86

    13. protected fields in, 105

    14. reading files in, 119

    15. statements in, 21

    16. switch in, 210211

    17. virtual base classes in, 130

    18. void in, 19, 21, 108

  2. cached thread pool, 259

  3. callback hell, 250

  4. call-by-name parameters, 179

  5. case classes, 219226

    1. declaring, 219

    2. default methods of, 219

    3. extending other case classes, 220

    4. formatted as JSON, 330

    5. modifying properties in, 220

    6. sealed, 222

  6. case clause, 210226

    1. _ in, 210211, 214215

    2. : in, 212213

    3. :: in, 215, 225

    4. `...` in, 212

    5. () in, 215

    6. =>, | in, 210

    7. catch-all pattern for, 210211

    8. enclosed in braces, 224225, 250

    9. enum in, 223

    10. infix notation in, 225226

    11. order of, 212

    12. variables in, 211212

  7. case objects, 219

  8. casts, 99

  9. catch statement, 3435

    1. as a partial function, 225

  10. chaining

    1. assignments, 22

    2. auxiliary constructors, 72

    3. futures, 251

    4. methods, 285, 291

    5. packages, 88

  11. Char type, 5, 23

  12. character sets, 120

  13. characters

    1. common, in two strings, 6

    2. in identifiers, 150

    3. reading, 23, 118119

    4. sequences of, 13

    5. uppercase, 13

  14. circular dependencies, 32

  15. class files, 31

    1. analyzing, 341

  16. class keyword, 63

  17. class path, 124

  18. classes, 11, 6374

    1. abstract, 101102, 134

    2. abstract types in, 286

    3. annotated, 232

    4. combined with primary constructor, 72

    5. companion objects to, 9, 74, 7879, 308

    6. concrete, 137

    7. constructed, for package-level functions, 89

    8. definitions of:

      1. executing statements in, 70

      2. using traits in, 133

    9. equality checks in, 109

    10. extending, 79, 98, 104

      1. Java classes, 101

      2. multiple traits, 132

      3. only one superclass, 130, 137

    11. extension methods in, 304

    12. final, 98, 104

    13. generic, 264, 268

    14. granting access to, 6869

    15. immutable, 7

    16. importing members of, 90

    17. inheritance hierarchy of, 106109

    18. inlined, 111112

    19. interoperating with Java, 66

    20. linearization of, 139

    21. names of, 64, 150

    22. nested, 7374

    23. open, 104

    24. primitive types and, 5

    25. properties of, 65, 67

    26. recompiling, 137

    27. sealed, 104105, 222, 330331

    28. serializable, 121, 234

    29. type parameters in, 264

    30. visibility of, 64

  19. classOf method (scala.Predef), 99

  20. ClassTag trait, 267

  21. close method

    1. of PrintWriter (Java), 120

    2. of Source, 118

  22. closures, 174175

  23. codeOf function (compiletime), 324325, 336

  24. coll method

    1. of Iterator, 202

    2. of Seq, 195

  25. collect method

    1. of Future trait, 254

    2. of Iterable, 193

    3. of IterableOps, 224

    4. of Iterator, 202

    5. with partial functions, 197

  26. CollectionConverters object, 47, 55, 204205, 218

  27. collections, 183205

    1. adding elements of, 190192

    2. appending to array buffers, 40

    3. applying functions to all elements of, 173, 193197

    4. combining, 200201

    5. companion objects of, 185

    6. constructing in a loop, 26, 42

    7. converting to specific type, 194

    8. filtering, 193

    9. folding, 193, 198200

    10. hierarchy of, 45, 184185

    11. immutable, 185186

    12. instances of, 185

    13. interoperating with Java, 204205

    14. iterators for, 201202

    15. methods for, 193195

    16. mutable, 152, 185186, 191192

    17. ordered, 184, 190

    18. reducing, 193, 197198

    19. removing elements of, 190192

    20. scanning, 200

    21. serializing, 122

    22. sorted, 184

    23. traits for, 184185

    24. traversing, 24, 42, 236237

    25. unevaluated, 204

    26. unordered, 184, 190, 192

  28. combinations method

    1. of Iterator, 202

    2. of Seq, 195

  29. companion objects, 9, 74, 7879

    1. extension methods in, 305

    2. implicits in, 308

    3. of collections, 185

  30. Comparable interface (Java), 265, 326

  31. Comparator interface (Java), 239, 326

  32. compareTo method, 265

  33. compiler

    1. implicits in, 308, 312313

    2. -language:implicitConversions flag, 307

    3. -language:postfixOps flag, 153

    4. nested type expressions in, 288

    5. optimizations in, 236238

    6. Scala annotations in, 232

    7. -Wconf, -Wunused:nowarn flags, 239

    8. -Xprint flag, 308

    9. -Yexplicit-nulls flag, 108

    10. -Ysafe-init flag, 106

  34. compiler plugin, 232

  35. compile-time errors, 23

  36. CompletableFuture class (Java), 258

  37. CompletionStage interface (Java), 247

  38. Component class (Java), 145

  39. compose method (Functionl), 177

  40. comprehensions, 27

  41. computations with side effects, 248

  42. concat method (StringOps), 13

  43. ConcurrentHashMap class (Java), 186

  44. console

    1. input from, 23, 119

    2. printing to, 22

  45. ConstantAnnotation trait, 240

  46. constants. See values

  47. constructor proxy methods, 80

  48. constructors

    1. auxiliary, 6970, 100

      1. chaining, 72

      2. eliminating, 71

    2. executing, 78

    3. order of, 105106, 138139

    4. parameterless, 71

    5. parameters of, 73, 234

      1. annotated, 240

    6. primary, 6973, 100

      1. annotated, 233

      2. default parameters in, 71

      3. private, 73

    7. superclass, 100101

    8. vals in, 106

  49. constValueXxx methods (scala.compiletime), 329

  50. Container class (Java), 145

  51. contains method, 52

    1. of BitSet, 190

    2. of Iterator, 202

    3. of Seq, 195

  52. containsSlice method

    1. of Iterator, 202

    2. of Seq, 195

  53. context bounds, 266, 300

  54. context functions, 309311

  55. context parameters, 10, 296299

  56. control abstractions, 178179

  57. Conversion class, 306

  58. copy method (case classes), 220

  59. corresponds method (Array), 177

  60. count method

    1. of Iterable, 193

    2. of Iterator, 202

    3. of StringOps, 13

  61. Coursier tool, 124

  62. curried method, 177

  63. Curry, Haskell Brooks, 176

  64. currying, 176177

D

  1. debugging

    1. implicit conversions, 309

    2. reading from strings for, 120

    3. reporting types for, 45

    4. using macros for, 336

  2. decrements, 7

  3. def keyword, 27, 171

    1. abstract, 103

    2. overriding, 102103

    3. parameterless, 102

  4. default statement, 210

  5. definitions, 26

  6. delegate method (Future object), 256

  7. dependent types, 287288

  8. @deprecated annotation, 82, 238, 240

  9. @deprecatedInheritance, @deprecatedOverriding annotations, 238

  10. @deprecatedName annotation, 45, 238

  11. derives keyword, 111, 331

  12. destructuring of tuples, 215

  13. diamond inheritance problem, 130131

  14. diff method

    1. of Iterator, 202

    2. of Seq, 195

    3. of sets, 190

  15. directories

    1. naming, 15

    2. packages and, 86

    3. traversing, 120121

  16. division, quotient and remainder of, 7, 217

  17. do loop, 23

  18. domain-specific languages, 149

  19. dot notation, 7

  20. Double type, 5

    1. reading, 23

  21. drop, dropWhile methods

    1. of Iterable, 193

    2. of Iterator, 202

  22. dropRight method (Iterable), 194

  23. duck typing, 283

  24. Duration object, 248

  25. dynamic invocation, 159162

  26. Dynamic trait, 159

  27. dynamically typed languages, 283

  28. DynamicProps class, 161

E

  1. Eiffel programming language, 67

  2. EmptyTuple object, 215

  3. end keyword, 23, 28

  4. end method, 125

  5. endsWith method

    1. of Iterator, 202

    2. of Seq, 195

  6. enum keyword, 8183, 330331

    1. parameterized, 83, 223224

  7. Enumeration class, 8183

    1. enumerations, 8183

    2. parameterized, 223224

    3. type parameters in, 223

  8. eq method (AnyRef), 109

  9. equals method

    1. of AnyRef, 109110

    2. of case classes, 219

    3. of value classes, 111

    4. overriding, 110

    5. parameter type of, 109

  10. Equiv class, 328

  11. erasedValue method (scala.compiletime), 325, 330

  12. error method (scala.compiletime), 325

    1. error messages

    2. for implicit conversions, 309, 312

    3. generated with annotations, 238

    4. suppressed, 239

    5. with override modifier, 98

  13. errors

    1. MatchError, 210, 217218

    2. NotImplementedError, 108

    3. OutOfMemoryError, 203

  14. escape hatch, 150

  15. eta expansion, 171

  16. evidence objects, 312

  17. exceptions, 3336

    1. ArrayStoreException, 270

    2. catching, 34

    3. checked, in Java, 33, 235

    4. IllegalArgumentException, 33

    5. IllegalStateException, 257

    6. InterruptedException, 249

    7. IOException, 235

    8. LoggedException, 140, 144

    9. NoSuchElementException, 252

    10. NumberFormatException, 119, 250

  18. execution contexts, 258259

  19. ExecutionContext trait, 246, 310

  20. Executor interface (Java), 246

  21. Executors class, 259

  22. exists method

    1. of Iterable, 193

    2. of Iterator, 202

  23. @experimental annotation, 238

  24. export statement, 9293

    1. given in, 303

  25. expressions

    1. annotated, 233

    2. conditional, 1820

    3. traversing values of, 24

    4. type of, 18

    5. vs. functions, 171

  26. extends keyword, 82, 98, 131, 279

  27. extension keyword, 303306

  28. extension methods, 303306

    1. used by compiler, 308

  29. extractors, 126, 155159, 216217

F

  1. f prefix, in formatted strings, 22

  2. failed method

    1. of Future object, 256

    2. of Future trait, 253254

  3. Failure class, 249

  4. failure method (Promise), 257

  5. fallbackTo method (Future trait), 253254

  6. fall-through problem, 210

  7. false value, 64

  8. @field annotation, 240

  9. fields

    1. abstract, 102, 137

    2. annotated, 232

    3. concrete, 102, 136137

    4. for primary constructor parameters, 72, 234

    5. getter/setter methods for, 66, 72

    6. hash codes of, 110

    7. object-private, 6869, 71

    8. overriding, 102103, 137

      1. in subclasses, 98

    9. protected, 105

    10. public, 65

    11. static, 78

    12. transient, 235

    13. volatile, 236

  10. files

    1. appending, 123

    2. binary, 120

    3. naming, 15

    4. packages and, 86

    5. processing, 117124

    6. reading, 118119

    7. redirecting input/output from/to, 123

    8. source, 89

    9. writing, 120

  11. Files class (Java), 118, 120121

  12. filter method, 43, 57, 174

    1. applied to lazy lists, 204

    2. of Future trait, 254

    3. of Iterable, 193

    4. of Iterator, 202

  13. filterNot method

    1. of Iterable, 193

    2. of Iterator, 202

  14. final keyword, 67, 98

  15. finally statement, 3435

  16. find method

    1. of Future object, 256

    2. of Iterator, 202

  17. findXxxIn methods (Regex), 124

  18. firstCompletedOf method (Future object), 256

  19. flatMap method, 195197

    1. of Future, 252

    2. of Iterable, 193

    3. of Iterator, 202

    4. of Try, 253

  20. flatten method (Future trait), 254

  21. Float type, 5

    1. reading, 23

  22. fluent interfaces, 286

  23. fold method

    1. of Iterable, 193

    2. of Iterator, 202

  24. foldLeft method, 180

    1. of Future object, 256

    2. of Iterable, 193, 198199, 271

    3. of Iterator, 202

  25. foldRight method

    1. of Iterable, 193, 199

    2. of Iterator, 202

  26. for loop, 2426

    1. constructing collections in, 26, 42

    2. enhanced (Java), 42

    3. for arrays, 4143

    4. for futures, 252

    5. for maps, 54

    6. for regex groups, 126

    7. given in, 301

    8. guards in, 219, 252

    9. Option type in, 56

    10. pattern matching in, 218

    11. range-based (C++), 42

  27. for case loop, 218

  28. forall method

    1. of Iterable, 193

    2. of Iterator, 202

  29. foreach method, 57, 174, 197

    1. of Future, 253

    2. of Future trait, 254

    3. of Iterable, 193

    4. of Iterator, 202

  30. fork-join pool, 258

  31. formatted strings, 22

  32. Fortran programming language, 163

  33. Fraction class, 156, 306308

  34. Fraction companion object, 308

  35. Fractional class, 328

  36. fragile base class problem, 98

  37. fromOrdinal method (enumerations), 82

  38. FromString class, 328

  39. fromString method (Source), 120

  40. fromTry method (Future object), 256

  41. fromURL method (Source), 120

  42. Function1 trait, 177

  43. functional programming languages, 169

  44. functions, 2729, 169180

    1. anonymous, 170172

    2. as method parameters, 13, 170

    3. binary, 174, 197

    4. calling, 89, 170

    5. context, 309311

    6. converting to Java interfaces, 176

    7. curried, 176179, 296

    8. declaring, 27

    9. exiting immediately, 28

    10. for all elements of a collection, 173

    11. generic, 264265, 267

    12. higher-order, 172174

    13. identity, 312

    14. mapping, 195197

    15. names of, 150, 306

    16. package-level, 89

    17. parameterless, 3132, 178179

    18. parameters of, 27

      1. call-by-name, 179

      2. default, 29

      3. named, 29

      4. other functions as, 171172

      5. type deduction in, 172

      6. variable, 30

    19. partial, 197, 224225

    20. passing to another function, 170172

    21. polymorphic, 273274

    22. recursive, 2730

    23. return type of, 5, 27, 29

    24. return value of, 178179

    25. scope of, 174

    26. single-argument, 172, 269

    27. storing in variables, 170

    28. syntax of, 155

    29. type parameters in, 264265

    30. type-level, 334

    31. unary, 177178

    32. variance of, 269

    33. vs. methods, 171

  45. Future companion object, 255257

    1. apply method, 251, 259

    2. delegate method, 256

    3. failed method, 256

    4. find method, 256

    5. firstCompletedOf method, 256

    6. foldLeft method, 256

    7. fromTry method, 256

    8. never object, 257

    9. reduceLeft method, 256

    10. successful method, 256

    11. traverse method, 255

    12. unit value, 257

  46. Future interface (Java), 247

  47. future method (Promise), 257

  48. Future trait, 246259, 310

    1. andThen method, 254

    2. collect method, 254

    3. failed, fallbackTo methods, 253254

    4. filter method, 254

    5. flatMap method, 252

    6. flatten method, 254

    7. foreach method, 253254

    8. isCompleted method, 248

    9. map method, 251252

    10. onComplete method, 250

    11. onFailure method, 250

    12. onSuccess method, 250

    13. ready method, 249

    14. recover, recoverWith methods, 253254

    15. result method, 249

    16. transform, transformWith methods, 254

    17. value method, 248

    18. zip, zipWith methods, 254255

  49. futures, 246259

    1. blocking waits for, 250

    2. chaining, 251

    3. concurrent, 246

    4. creating, 246

      1. delayed, 252

    5. execution context of, 258259

  50. results of, 247, 257

  51. tasks of:

    1. composing, 251253

    2. failing, 248

    3. running, 246248

  52. transformations of, 253255

G

  1. generators, 26

  2. generic arrays, 267

  3. generic classes, 264

    1. methods used under certain conditions

      1. in, 268

  4. generic functions, 264265, 267

  5. generic methods, 264

  6. generic types

    1. erased, in JVM, 213, 267

    2. variance of, 269273

  7. get method

    1. of Map, 52, 56

    2. of Try, 249

  8. getLines method (Source), 118, 203

  9. getOrElse method (Map), 52, 56

  10. getOrElseUpdate method (Map), 186

  11. @getter annotation, 240

  12. getXxx methods, 66, 234

  13. given keyword, 297, 299303

    1. export with, 303

    2. extension methods in, 305

    3. import with, 302303

    4. match with, 301

    5. with for, 301

  14. given values, 266

  15. groupBy, groupMap, groupMapReduce methods

  16. (Iterable), 194, 197

  17. grouped method

    1. of Iterable, 194, 201

    2. of Iterator, 202

  18. guards, 26, 42, 211

    1. in for statements, 219, 252

    2. variables in, 211

H

  1. hash codes, 107, 110

  2. hash maps, 55

  3. hash sets, 189

  4. hash tables, 54

  5. hashCode method, 189

    1. of AnyRef, 110

    2. of case classes, 219

    3. of value classes, 111

    4. overriding, 110

  6. Hashing class, 328

  7. Haskell programming language, 29, 327

  8. hasNext method

    1. of Iterable, 201

    2. of Iterator, 133

  9. head method

    1. of BufferedIterator, 202

    2. of Iterable, 193

    3. of lists, 188189

    4. of Source, 119

  10. headOption method (Iterable), 193

  11. heterogeneous lists, 319321

  12. hexadecimal literals, 5

  13. Hindley-Milner algorithm, 29

  14. HTTP (Hypertext Transfer Protocol), 120

I

  1. identifiers, 150

  2. identity functions, 312

  3. if expression, in loop generators, 26, 42

  4. if/else expression, 1820, 34

  5. IllegalArgumentException, 33

  6. IllegalStateException, 257

  7. immutability, 7

  8. implements keyword, 131

  9. implicit conversions, 47, 149, 306309

    1. ambiguous, 307

    2. debugging, 309

    3. for strings to ProcessBuilder objects, 122

    4. importing, 308309

    5. naming, 306

    6. rules for, 307308

    7. unwanted, 307308

    8. used by compiler, 308

  10. implicit keyword, 14, 46

  11. implicit parameters, 14

  12. @implicitNotFound annotation, 312313

  13. import statement, 86, 9092

    1. given in, 302303

    2. implicit, 92

    3. location of, 91

    4. overriding, 92

    5. selectors for, 91

    6. wildcards in, 8, 9091

  14. increments, 7

  15. IndexedSeq trait, 13, 184, 187

    1. immutable, 186

  16. indexXxr methods

    1. of Iterator, 202

    2. of Seq, 195

  17. infix notation

    1. for anonymous functions, 171

    2. for operators, 151153

    3. for type parameters, 264

    4. in case clauses, 225226

  18. inheritance, 97112

    1. diamond, 130131

    2. hierarchy of, 106109

    3. multiple, 129131

    4. vs. composition, 93

  19. init method (Iterable), 193

  20. inline code, 323326

  21. inline keyword, 324326

  22. instances, 81

    1. comparing, 111, 327

    2. constructing, 162, 185

    3. creating on the fly, 282

    4. dependent types and, 288

    5. given, 299301, 328329

    6. state of, 82

  23. Int type, 5, 265, 268

    1. immutability of, 7

    2. no null value in, 108

    3. reading, 23

  24. integer literals, 5

  25. integer types, 322, 334

  26. interfaces, 130

    1. fluent, 286

    2. rich, 133

  27. InterruptedException, 249

  28. intersect method

    1. of Iterator, 202

    2. of Seq, 195

    3. of sets, 190

    4. of StringOps, 6

  29. intersection types, 144, 278279, 282

  30. intertwining classes and constructors, 100

  31. IOException, 235

  32. isCompleted method

    1. of Future, 248

    2. of Promise, 258

  33. isDefinedAt method (PartialFunction), 224

  34. isEmpty method

    1. of Iterable, 193

    2. of Iterator, 202

  35. isFailure method (Try), 249

  36. isInstanceOf method (Any), 99, 107, 212

  37. IsIterable, IsIterableOnce, IsMap, IsSeq classes, 328

  38. isSuccess method (Try), 249

  39. istream::peek function (C++), 119

  40. Iterable trait, 13, 45, 184, 332334

    1. map method, 333

    2. methods of, 193195, 201, 271

  41. IterableOnce trait, 13, 45

  42. IterableOps trait, 224

  43. iterator method (collections), 201

  44. Iterator trait, 133, 184

  45. iterators, 118, 201202

    1. constructing lazy lists from, 203

    2. fragility of, 202

J

  1. Jakarta EE, 232

  2. Java programming language

    1. ?: operator in, 18

    2. annotations in, 232236

    3. arrays in, 40, 4647, 185, 270

    4. assignments in, 22

    5. checked exceptions in, 33, 235

    6. classes in, 98

      1. hierarchy of, 73

      2. serializable, 121

    7. closures in, 175

    8. collections in, 185

    9. comparing objects in, 110

    10. completable futures in, 258

    11. ConcurrentHashMap in, 186

    12. construction order in, 106

    13. constructors in, 69

    14. enumerations in, 82

    15. fields in, 65, 105

    16. file processing in, 118

    17. functional (SAM) interfaces in, 175

    18. futures in, 247

    19. generic types in, 272

    20. hashCode method in, 189

    21. interfaces in, 129132, 141143

    22. interoperating with Scala:

      1. arrays, 4748

      2. classes, 66, 101, 232

      3. collections, 204205

      4. maps, 55, 218

      5. methods, 235

      6. traits, 141143

    23. lambda expressions in, 175

    24. linked lists in, 185, 188

    25. loops in, 23, 42

    26. maps in, 185

    27. methods in, 78, 99, 105

      1. static, 9, 27

    28. missing values in, 268

    29. modifiers in, 236

    30. new operator in, 40

    31. no multiple inheritance in, 130

    32. no operator overloading in, 8

    33. no variance in, 239

    34. null value in, 108

    35. packages in, 86, 8889

    36. primitive types in, 40, 106

    37. reading files in, 119120

    38. statements in, 21

    39. superclass constructors in, 101

    40. synchronized in, 107

    41. toString method in, 45

    42. traversing directories in, 120121

    43. try-with-resources statement in, 36

    44. type checks and casts in, 99

    45. void in, 19, 21, 108

    46. wildcards in, 272

  3. Java AWT library, 145

  4. java.io.BufferedInputStream class, 146

  5. java.io.PrintWriter class, 120

  6. java.lang package, 92

  7. java.lang.Appendable interface, 132, 281282

  8. java.lang.AutoCloseable interface, 132

  9. java.lang.Enum class, 82

  10. java.lang.Object class, 107

  11. java.lang.ProcessBuilder class, 48

  12. java.lang.String class, 6, 40

  13. java.lang.Throwable class, 33

  14. java.math.BigX.rx classes, 6

  15. java.nio.file.Files class, 118, 120121

  16. java.util package, 205

  17. java.util.ArrayList class, 40, 47, 185

  18. java.util.Arrays class, 47

  19. java.util.Comparator class, 239

  20. java.util.concurrent.CompletableFuture class, 258

  21. java.util.concurrent.CompletionStage interface, 247

  22. java.util.concurrent.Executor interface, 246

  23. java.util.concurrent.Executors class, 259

  24. java.util.concurrent.Future interface, 247

  25. java.util.LinkedList class, 185

  26. java.util.List interface, 47, 185

  27. java.util.Properties class, 55, 218

  28. java.util.RandomAccess interface, 185

  29. java.util.Scanner class, 59, 119

  30. JavaBeans specification, 145

  31. JavaScript programming language

    1. arrays in, 40, 46

    2. closures in, 175

    3. duck typing in, 283

    4. loops in, 42

    5. methods in, 78

    6. translating from Scala, 10

  32. javax.swing.JTextArea class, 281

  33. JButton, JComponent classes (Swing), 145

  34. JDK (Java Development Kit), source code for, 226

  35. JSON companion object, 331

  36. JSON trait, 305306, 328330

  37. JSON-B framework, 232

  38. @JsonbProperty annotation, 233, 240

  39. JTextArea class (Java), 281

  40. JUnit framework, 232

  41. JVM (Java Virtual Machine)

    1. arrays in, 40

    2. classes in, 137

    3. generic types in, 213, 267

    4. stack size of, 237

    5. terminating, 246

    6. volatile fields in, 236

K

  1. keySet method (Map), 54

L

  1. lambda expressions, 175, 273274

  2. last, lastOption methods (Iterable), 193

  3. lastIndexOf, lastIndexOfSlice methods

    1. of Iterator, 202

    2. of Seq, 195

  4. lazy keyword, 3233

  5. lazy lists, 202204

  6. lazy values, 238

  7. lazyZip method

    1. of Iterable, 194

    2. of Iterator, 202

  8. length method

    1. of Iterable, 193

    2. of Iterator, 202

  9. lift method, 126

  10. linearization, 139

  11. LinearSeq trait, 13

  12. lines, 118

  13. linked hash sets, 190

  14. LinkedHashMap class, 55

  15. LinkedList class (Java), 185

  16. List class, 332

    1. immutable, 186187

  17. List interface (Java), 47, 185

  18. list method (java.nio.file.Files), 121

  19. ListBuffer class, 187

  20. lists, 188189

    1. adding elements of, 191192

    2. constructing, 154, 188

    3. destructuring, 189

    4. empty, 108, 319

    5. heterogeneous, 227, 319321

    6. immutable, 202, 271

    7. lazy, 123, 202204

    8. linked, 184

    9. pattern matching for, 215, 225

    10. removing elements of, 191192

    11. traversing, 188

    12. vs. arrays, 185

  21. literal types, 283284, 322323

  22. literals, 5

  23. log messages

    1. adding timestamp to, 134

    2. truncating, 134, 137

    3. types of, 133

  24. LoggedException trait, 140, 144

  25. Logger trait, 133

  26. Long type, 5

    1. reading, 23

  27. loops, 2326

    1. breaking out of, 25

    2. for collections, 24

    3. variables within, 26

    4. vs. folding, 199200

M

  1. macros, 335339

  2. main method, 81

  3. @main annotation, 31, 81, 232

  4. map method, 43, 57, 173

    1. applied to lazy lists, 204

    2. of Future, 251252

    3. of Iterable, 193197, 333

    4. of Iterator, 202

    5. of Try, 253

  5. Map trait, 52, 184186

    1. get, getOrElse methods, 52, 56

    2. immutable, 186

    3. keySet, values methods, 54

  6. mapInPlace method

    1. of ArrayBuffer, 196

    2. of Iterable, 193

    3. of Iterator, 202

  7. maps, 5159

    1. blank, 52

    2. constructing, 52

      1. from collection of pairs, 59

    3. function call syntax for, 155

    4. interoperating with Java, 55

    5. inverting, 54

    6. iterating over, 54

    7. keys of:

      1. checking, 52

      2. removing, 53

      3. visiting in insertion order, 55

    8. mutable/immutable, 5253, 55, 185

    9. sorted, 55

    10. traversing, 218

    11. updating values of, 53

    12. values of, 52

  8. match expression, 58, 210211, 222

    1. given in, 301

    2. on types, 318319

    3. processing Try instances with, 249

    4. using with inline, 326

  9. Match class, 126

  10. match types, 318319

  11. Matchable trait, 18, 213214

  12. matched method, 125

  13. MatchError, 210, 217218

  14. matches method (String), 124, 338

  15. Math class, 8

  16. mathematical functions, 8, 13

  17. max method

    1. of ArrayBuffer, 44

    2. of Iterable, 193

    3. of Iterator, 202

  18. maxBy, maxByOption, maxOption methods

    1. of Iterable, 193

    2. of Iterator, 202

  19. MessageFormat class (Java), 298

  20. methods

    1. abstract, 102103, 131, 135136, 141143, 299

    2. abundance of, 11, 14

    3. accessor, 65

    4. annotated, 232

    5. as arithmetic operators, 7

    6. calling, 2, 5, 89, 64, 6667, 135

    7. chained, 285, 291

    8. clashes of, in sub- and superclasses, 98

    9. co-/contravariant, 312

    10. constructor proxy, 80

    11. declaring, 27

    12. executed lazily, 203

    13. extension, 303306

    14. final, 99, 109, 237

    15. for primary constructor parameters, 72

    16. generic, 264

    17. getter/setter, 6568, 102

    18. modifiers for, 8990

    19. mutator, 65

    20. names of, 7, 13

      1. misspelled, 98

    21. overriding, 9899, 102103, 135136

    22. parameterless, 8, 64, 102

    23. parameters of, 7, 264, 271, 286

      1. functions for, 13, 170

      2. implicit, 14

      3. using, 267

      4. wrong type, 98

    24. private, 237

    25. protected, 105

    26. public, 66

    27. return type of, 271, 285

    28. return value of, 264

    29. static, 78

    30. type parameters in, 264265

    31. used under certain conditions, 268

    32. variable-argument, 235

    33. vs. functions, 171

  21. Meyer, Bertrand, 67

  22. min method

    1. of ArrayBuffer, 44

    2. of Iterable, 193

    3. of Iterator, 202

    4. of scala.math, 8

  23. minBy, minByOption, minOption methods

    1. of Iterable, 193

    2. of Iterator, 202

  24. MirroredXxr types, 329, 331

  25. mirrors, 328330

  26. mkString method

    1. applied to lazy lists, 204

    2. of Array, ArrayBuffer, 44

    3. of Iterable, 194

    4. of Iterator, 202

    5. of Source, 118119

  27. ML programming language, 29

  28. mulBy function, 172, 175

  29. multiple inheritance, 129131

  30. multiply method (Java), 151

  31. multiversal equality, 110111

N

  1. @native annotation, 236

  2. negation operator, 13

  3. nested structures, 221222

  4. never object (Future object), 257

  5. new keyword, 40, 73

    1. omitting, 219, 221

    2. required, 101, 134

  6. newline character

    1. in long statements, 20

    2. in printed values, 22

    3. inside loops, 26

  7. next method

    1. of Iterable, 201

    2. of Iterator, 133

  8. Nil list, 108, 188189, 239

  9. None object, 5657, 219, 222

  10. NonLocalReturns object, 28, 180

  11. NoSuchElementException, 252

  12. Nothing type, 34, 108, 272

  13. notify, notifyAll methods (AnyRef), 107

  14. NotImplementedError, 108

  15. @nowarn annotation, 239

  16. Null type, 108

  17. null value, 64, 108, 268

  18. NumberFormatException, 119, 250

  19. numbers

    1. classes for, 13

    2. converting:

      1. between numeric types, 6, 10

      2. to arrays, 119

    3. greatest common divisor of, 164

    4. invoking methods on, 5

    5. literals for, 5

    6. random, 9

    7. ranges of, 13

    8. reading, 23, 119

    9. sums of, 44

O

  1. Object class (Java), 107

  2. object keyword, 7883, 286

  3. objects, 7783

    1. adding traits to, 133

    2. companion, 9, 74, 7879, 185, 308

    3. comparing, 110111

    4. constructing, 10, 64, 78, 134

    5. default methods for, 189

    6. equality of, 109110

    7. evidence, 312

    8. exporting, 9293

    9. extending class or trait, 79

    10. extension methods in, 304

    11. extracting values from, 216

    12. given, 298

    13. importing members of, 90

    14. nested, 221

    15. nested classes in, 7374

    16. no type parameters for, 271

    17. pattern matching for, 212

    18. serializing, 121, 278

    19. testing whether belongs to a given class, 99

    20. variance of, 270

  4. ofDim method (Array), 46

  5. onComplete, onFailure, onSuccess methods (Future), 250

  6. opaque types, 112, 214

  7. open keyword, 104

    1. operators, 149155

    2. arithmetic, 78

    3. assignment, 153154

    4. associativity of, 154

    5. binary, 152155

    6. for adding/removing elements, 190192

    7. infix, 151, 153

    8. overloading, 8

    9. postfix, 152153

    10. precedence of, 153154

    11. unary, 152153

  8. optimization, 236238

  9. Option class, 52, 5657, 125, 156, 193, 219, 222

    1. orNull method, 268

    2. using with for, 56

  10. Ordering class, 44, 328

  11. ordinal method (enumerations), 81

  12. orNull method (Option), 268

  13. OutOfMemoryError, 203

  14. override keyword, 9899, 102103, 136

    1. omitted, 102, 131

  15. @Overrides annotation, 99

P

  1. package objects, 8

  2. package.scala file, 89

  3. package-level functions, 89

  4. packages, 8592

    1. adding items to, 86

    2. chained, 88

    3. defined in multiple files, 86

    4. extension methods in, 304

    5. importing, 8, 9092

      1. always, 92

      2. selected members of, 91

    6. modifiers for, 8990

    7. naming, 88, 92

    8. nested, 8788

    9. top-of-file notation for, 88

  5. padTo method

    1. of Iterator, 202

    2. of Seq, 195

  6. Pair class, 272

  7. @param annotation, 240

  8. parameters

    1. annotated, 232

    2. contex, 10, 296299

    3. curried, 311

    4. deprecated, 238

    5. implicit, 14

    6. named, 220

  9. partial functions, 197, 224225

  10. PartialFunction class, 224225

  11. partition method

    1. of Iterable, 193

    2. of Iterator, 202

    3. of StringOps, 58

  12. Pascal programming language, 163

  13. pattern matching, 209226

    1. +: operator and, 192

    2. by type, 212213

    3. classes for. See case classes

    4. extractors in, 156

    5. extractors with, 216

    6. failed, 156

    7. for arrays, 214

    8. for lists, 189, 215, 225

    9. for maps, 54

    10. for nested structures, 221222

    11. for objects, 212

    12. for tuples, 58, 215

    13. for types, 318319

    14. guards in, 211

    15. in for expressions, 218

    16. in variable declarations, 217218

    17. not exhaustive, 239

    18. Option type with, 219

    19. partial functions with, 224225

    20. regular expressions in, 216

    21. sealed classes and, 105

    22. variables in, 211212

    23. vs. type checks and casts, 99

  14. permutations method

    1. of Iterable, 201

    2. of Iterator, 202

    3. of Seq, 195

  15. piping, 123

  16. Point class, 328

  17. polymorphism, 221, 273274

  18. postfix operators, 152153

  19. pow function (scala.math), 8, 27, 163

  20. Predef object

    1. always imported, 92, 99, 186

    2. classOf method, 99

    3. implicits in, 311

  21. prefixLength method

    1. of Iterator, 202

    2. of Seq, 195

  22. primitive types, 5

    1. arrays of, 40

  23. print function, 22, 119

  24. printf function, 120

  25. println function, 22

  26. PrintWriter class (Java), 120

  27. PriorityQueue class, 187

  28. private keyword, 6474, 89

  29. probablePrime method (BigInt), 9

  30. procedures, 29

  31. process control, 122124

  32. Process object, 123

  33. ProcessBuilder class (Java), 48

    1. constructing, 123

    2. implicit conversions to, 122

  34. product method

    1. of Iterable, 193

    2. of Iterator, 202

  35. Product trait, 220, 329

  36. product types, 220, 224

  37. programs

    1. entry point of, 31, 81

    2. implicit imports in, 92

    3. piping, 123

    4. readability of, 8

    5. self-documenting, 290

  38. Promise trait, 257258

  39. promises, 257258

  40. properties, 65

    1. read-only, 67

    2. write-only (not possible), 68

  41. Properties class (Java), 55, 218

  42. property change listeners, 145

  43. protected keyword, 89, 105

  44. public keyword, 64, 89

  45. PushbackInputStreamReader class (Java), 119

  46. putIfAbsent method (Map), 186

  47. Python programming language

    1. ?: operator in, 18

    2. arrays in, 40, 46

    3. closures in, 175

    4. loops in, 23, 42

    5. modules in, 86

Q

  1. Queue class, 187

R

  1. r method (String), 124, 126

  2. Random object, 9

  3. RandomAccess interface (Java), 185

  4. Range class, 6, 13, 194, 333

    1. immutable, 187

    2. traversing, 24

  5. raw prefix, in formatted strings, 22

  6. raw string syntax, 124

  7. readXxx methods (scala.io.StdIn), 23, 119

  8. ready method

    1. of Await, 248

    2. of Future trait, 249

  9. recover, recoverWith methods (Future trait), 253254

  10. recursions, 186

    1. for lists, 188

    2. tail, 237

  11. reduce method

    1. of Iterable, 193

    2. of Iterator, 202

  12. reduceLeft method, 174

    1. of Future object, 256

    2. of Iterable, 193, 197

    3. of Iterator, 202

  13. reduceRight method

    1. of Iterable, 193, 198

    2. of Iterator, 202

  14. reference types

    1. == operator for, 110

    2. assigning null to, 108

  15. reflective calls, 282

  16. Regex class, 124126

    1. findXxxIn methods, 124

    2. replaceXrdn methods, 125, 225

  17. regular expressions, 124126

    1. for extractors, 216

    2. grouping, 126

    3. raw string syntax in, 124

  18. remove method (Map), 186

  19. REPL (read-eval-print loop), 34

    1. autocompletion in, 247

    2. defining companion objects in, 79

    3. displaying () value in, 19

    4. nearsightedness of, 19

    5. pasted code in, 20

    6. types in, 170

  20. replace method (Map), 186

  21. replaceXxxIn methods (Regex), 125, 225

  22. result method

    1. of Await, 248

    2. of Future trait, 249

    3. with TailRec object, 237

  23. return keyword, 28, 179

  24. reverse method

    1. of Iterator, 202

    2. of Seq, 195

  25. rich interfaces, 133

  26. RichChar class, 6

  27. RichDouble class, 6, 13

  28. RichInt class, 6, 13, 24, 187

  29. _root_ prefix, in package names, 88

  30. Ruby programming language

    1. closures in, 175

    2. duck typing in, 283

S

  1. s prefix, in formatted strings, 22

  2. scala package, always imported, 87, 92, 121, 186

  3. Scala programming language

    1. embedded languages in, 149

    2. interoperating with shell programs, 122

    3. interpreter of, 14

    4. methods vs. functions in, 27

    5. strongly typed, 159

    6. translating to JavaScript, 10

  4. scala. prefix, in package names, 9, 92

  5. scala.collection package, 205

  6. scala.collection.concurrent package, 186

  7. scala.collection.immutable package, 185

  8. scala.collection.mutable package, 185

  9. scala.compiletime package, 64

    1. codeOf function, 324325, 336

    2. constValueXxx methods, 329

    3. erasedValue method, 325, 330

    4. error method, 325

    5. summonXxx methods, 329, 335

  10. scala.compiletime.ops.any package, 323

  11. scala.compiletime.ops.int package, 323

  12. Scala.js project, 10

  13. scala.language.adhocExtensions object, 104

  14. scala.language.implicitConversions class, 307

  15. scala.language.strictEquality object, 110

  16. scala.math package, 8, 13

  17. scala.sys.process package, 122

  18. scala.util package, 9

  19. scalac program. See compiler

  20. Scaladoc tool, 6, 1114, 4546

  21. scanLeft method (ScanLeft), 200

  22. Scanner class (Java), 59, 119

  23. scanRight method (ScanLeft), 200

  24. sealed classes, 330331

  25. sealed keyword, 104, 222

  26. segmentLength method

    1. of Iterator, 202

    2. of Seq, 195

  27. Selectable trait, 162163, 282

  28. selectDynamic method

    1. of Dynamic, 160

    2. of DynamicProps, 161

    3. of Selectable, 162

  29. selectors

    1. dynamic, 159162

    2. for imports, 91

    3. typesafe, 162163

  30. self types, 143144

  31. Seq trait, 30, 45, 184187

    1. methods of, 195

  32. Seq[Char] class, 13

  33. sequences, 13

    1. adding elements of, 192

    2. as function parameters, 30

    3. comparing, 177

    4. extracting values from, 157

    5. filtering, 174

    6. integer, 187

    7. mutable/immutable, 187188

    8. of characters, 13

    9. removing elements of, 192

    10. reversing, 195

  34. sorting, 174, 195

    1. with fast random access, 187

  35. Serializable trait, 121

  36. serialization, 121, 234

  37. @SerialVersionUID annotation, 121, 234

  38. Set trait, 184

    1. immutable, 186

  39. sets, 189190

    1. difference, intersection, union of, 190191

    2. elements of, 189192

  40. @setter annotation, 240

  41. setXxx methods, 66, 234

  42. shadowing rule, 25

  43. shell scripts, 122124

  44. Short type, 5

    1. reading, 23

  45. @showAsInfix annotation, 264

  46. Singleton class, 284

  47. singleton objects, 89, 78, 286

    1. case objects for, 219

  48. singleton types, 284286

    1. inference of, 323

  49. sleep method (Thread), 246, 325

  50. slice method

    1. of Iterable, 194

    2. of Iterator, 202

  51. sliding method

    1. of Iterable, 194, 201

    2. of Iterator, 202

  52. Some class, 5657, 219, 222

  53. sortBy method

    1. of Iterator, 202

    2. of Seq, 195

  54. sorted method

    1. of ArrayBuffer, 44

    2. of Iterator, 202

    3. of Seq, 195

    4. of StringOps, 8, 14

  55. sorted sets, 190

  56. SortedMap trait, 55, 184

  57. SortedSet trait, 184

  58. sortInPlace method (Array), 44

  59. sortWith method, 174

    1. of ArrayBuffer, 44

    2. of Iterator, 202

    3. of Seq, 195

  60. source files, 89

  61. Source object, 118120

    1. close method, 118

    2. fromString, fromURL methods, 120

    3. getLines method, 118, 203

    4. mkString method, 118119

    5. toArray, toBuffer methods, 118

  62. span method

    1. of Iterable, 193

    2. of Iterator, 202

  63. splitAt method

    1. of Iterable, 193

    2. of Iterator, 202

  64. sqrt method (scala.math), 8

  65. src.zip file (JDK), 226

  66. Stack class, 187

  67. stack overflow, 237

  68. standard input, 120

  69. start method, 125

  70. startsWith method

    1. of Iterator, 202

    2. of Seq, 195

  71. statements

    1. indentation in, 21

    2. line breaks in, 20

    3. terminating, 20

  72. StaticAnnotation trait, 239

  73. stdin method, 120

  74. StdIn object, 23, 119

  75. strictEquality object, 110

  76. String class, 124, 126

    1. matches method, 338

    2. substring method, 27

  77. String class (Java), 6, 40

  78. string interpolation, 22

  79. StringBuilder class, append method, 58

  80. StringOps class, 6, 13, 58

    1. apply method, 9

    2. concat method, 13

    3. sorted method, 8, 14

  81. strings, 6

    1. characters in:

      1. common, 6

      2. concatenating, 13

      3. uppercase, 13

    2. classes for, 13

    3. converting:

      1. from any objects, 6

      2. to numbers, 10, 119

      3. to ProcessBuilder objects, 122

    4. formatted, 22

    5. sorting, 8

    6. traversing, 25

  82. structural types, 162, 281283

  83. subclasses

    1. anonymous, 101

    2. concrete, 102

    3. equality in, 109

    4. implementing abstract methods in, 131

    5. mixing traits into, 143144

  84. subsetOf method (BitSet), 190

  85. substring method (String), 27

  86. Success class, 249

  87. success method (Promise), 257

  88. successful method (Future object), 256

  89. sum method

    1. of ArrayBuffer, 44

    2. of Iterable, 193

    3. of Iterator, 202

  90. summonXxx methods (scala.compiletime), 329, 335

  91. super keyword, 99, 135

  92. super keyword (Java), 101

  93. superclasses, 140141

    1. abstract fields in, 102

    2. constructing, 100101

    3. extending, 142

    4. methods of:

      1. abstract, 102

      2. clashing with subclass methods, 98

      3. overriding, 103

    5. no multiple inheritance of, 130, 132, 137

    6. of traits, 141

    7. sealed, 222

  94. supertypes, 18, 108, 266

  95. Swing toolkit, 145146

  96. switch statement, 19, 210

  97. synchronized method (AnyRef), 107

  98. synchronous computations, 257

T

  1. tab completion, 2

  2. tail method

    1. of Iterable, 193

    2. of lists, 188189

  3. TailCalls, TailRec objects, 237

  4. @tailrec annotation, 237

  5. take, takeWhile methods

    1. of Iterable, 193

    2. of Iterator, 202

  6. takeRight method (Iterable), 194

  7. @targetName annotation, 151

  8. tasks

    1. assigning threads to, 246

    2. blocking, 246

    3. composing, 251253

    4. concurrent, 248249, 251, 257

    5. failing, 248, 252

    6. running, 246248

      1. in the future, 246248

      2. on daemon thresds, 246

      3. one after another, 252

    7. terminating, 247

    8. throwing exceptions, 248

  9. waiting, 248249, 258

  10. then keyword, 18

  11. this keyword, 69, 72, 143144, 285

  12. Thread class (Java), stop method, 239

  13. Thread class, sleep method, 246, 325

  14. thread pool, 246

  15. threads

    1. assigning tasks to, 246

    2. blocking, 249250

    3. daemon, 246

  16. @threadUnsafe annotation, 238

  17. throw expression, 34

  18. Throwable class (Java), 33

  19. @throws annotation, 235

  20. to method

    1. of collections, 185

    2. of Iterable, 194

    3. of Iterator, 202

    4. of RichInt, 6, 24, 187

  21. toArray method

    1. of ArrayBuffer, 41

    2. of Iterable, 194

    3. of Iterator, 202

    4. of Source, 118

  22. toBuffer method

    1. of Array, 41

    2. of Iterable, 194

    3. of Iterator, 202

    4. of Source, 118

  23. toChar method (RichInt), 6

  24. toDouble method (RichInt), 6, 119

  25. toIndexedSeq method

    1. of Iterable, 194

    2. of Iterator, 202

  26. toInt method (RichInt), 6, 119

  27. toIterable, toList methods

    1. of Iterable, 194

    2. of Iterator, 202

  28. toMap method

    1. for tuples, 59

    2. of collections, 185

    3. of Iterable, 194

    4. of Iterator, 202

  29. toScala method, 205

  30. toSeq, toSet methods

    1. of collections, 185

    2. of Iterable, 194

    3. of Iterator, 202

  31. toString method

    1. from Java, 45

    2. of case classes, 219

    3. of enumerations, 82

    4. of RichInt, 6

  32. toVector method

    1. of Iterable, 194

    2. of Iterator, 202

  33. trait keyword, 131

  34. traits, 131144

    1. abstract types in, 286

    2. adding to objects, 133

    3. construction order of, 135136

    4. constructors for, 138140

    5. extending, 79, 286

      1. classes, 140141

      2. superclass, 142

    6. extension methods in, 304

    7. fields in:

      1. abstract, 137

      2. concrete, 136137

    8. for collections, 184185

    9. for rich interfaces, 133

    10. implementing, 131, 267

    11. initializing, 140

    12. layered, 134135

    13. methods of, 132135, 141143

      1. overriding, 135136

      2. unimplemented, 131

    14. mixing into classes, 143144

    15. superclasses of, 141

    16. transparent, 143

    17. type parameters in, 264

    18. universal, 112

    19. vs. Java interfaces, 129132, 141143

    20. vs. structural types, 282

    21. with a self type, 143144

  35. trampolining, 237

  36. transform, transformWith methods (Future trait), 254

  37. @transient annotation, 235

  38. transparent keyword, 143

  39. traverse method (Future object), 255

  40. Try class, 35, 249

    1. flatMap method, 253

    2. get method, 249

    3. isFailure method, 249

    4. isSuccess method, 249

    5. map method, 253

  41. try statement, 3435, 225

  42. trySuccess method (Promise), 257

  43. tupled method, 178

  44. tuples, 5758

    1. accessing components of, 57

    2. converting to maps, 59

    3. pattern matching for, 215

    4. zipping, 59

  45. type classes, 326328

    1. derivation of, 330331

  46. type constraints, 267268, 311312

  47. type constructors, 332334

  48. type errors, 159, 270

  49. type keyword, 279281, 284286

  50. type lambdas, 334335

  51. type parameters, 13, 263274

    1. annotated, 232

    2. context bounds for, 300

    3. curried, 273

    4. in enumerations, 223

    5. not possible for objects, 271

    6. vs. abstract types, 287

  52. type projections, 74, 288

  53. type variables, bounds for, 265267

  54. type-level programming, 317339

  55. types, 56, 277290

    1. abstract, 281, 286287, 289290

    2. aliases for, 186, 279281

    3. annotated, 233

    4. anonymous, 102

    5. checking, 99

    6. concatenating, 322

    7. converting, 6, 267

    8. dependent, 287288

    9. dynamic, 159

    10. equality of, 267

    11. generic, 213, 267, 269273

    12. higher-kinded, 332334

    13. implementing multiple traits, 267

    14. implicit scope of, 304

    15. intersection, 144, 278279, 282

    16. invariant, 270

    17. literal, 283284, 322323

    18. match, 212213, 318319

    19. naming, 290

    20. not matchable, 213

    21. opaque, 112, 214, 280281

    22. primitive, 5, 40

    23. product, 220, 224

    24. self, 143144

    25. singleton, 284286

    26. structural, 162, 281283

    27. subtypes of, 267

    28. supertypes of, 18, 108

    29. union, 277278

    30. wrapper, 6

  56. typesafe selection, 162163

U

  1. unapply method, 155159, 216, 225226

    1. of case classes, 219, 221

  2. unapplySeq method, 157159, 216

  3. unary operators, 152153

  4. unary_- method (BigInt), 13

  5. unary_op methods, 152

  6. @unchecked annotation, 238239

  7. @uncheckedVariance annotation, 239

  8. Unicode characters, 150

  9. uniform access principle, 67

  10. uniform creation principle, 185

  11. uniform return type principle, 194

  12. uninitialized value, 64

  13. union method (sets), 190

  14. union types, 277278

  15. Unit class, 29, 106, 108

    1. value of, 1922

  16. unit method (Future object), 257

  17. universal traits, 112

  18. until method, 187

  19. until statement, 179

  20. update method, 155

  21. updateDynamic method

    1. of Dynamic, 160

    2. of DynamicProps, 161

  22. updateWith method (Map), 186

  23. URLs (Uniform Resource Locators)

    1. reading from, 120

    2. redirecting input from, 123

  24. using keyword, 267, 296312

  25. Using object, 36

  26. using parameters, 267

    1. currying, 298

    2. declared by name, 299

    3. explicit, 296, 300

    4. multiple, 298

    5. used by compiler, 308

    6. with common types, 297

    7. with given instances, 300

    8. with literal types, 322

  27. UTF-16 encoding, 205

V

  1. val fields, 4

    1. declarations of, 45, 156

    2. generated methods for, 69, 72, 234

    3. initializing, 4, 21, 3233

    4. lazy, 3233

    5. overriding, 102103, 105

    6. private, 69

    7. specifying type of, 5

    8. storing functions in, 170

  2. value classes, 111112

  3. value method (Future trait), 248

  4. valueAtOneQuarter function, 172

  5. valueOf method (enumerations), 82

  6. values

    1. binding to variables, 221

    2. default, 64

    3. given, 297, 302303, 306

    4. lazy, 238

    5. naming, 212

    6. printing, 22

  7. values method

    1. of enumerations, 82

    2. of Map, 54

  8. van der Linden, Peter, 210

  9. var fields, 4

    1. annotated, 232

    2. declarations of, 45

      1. pattern matching in, 217218

    3. generated methods for, 69, 72, 234

    4. initializing, 4

    5. overriding, 103

    6. private, 69

    7. specifying type of, 5, 264

    8. updating, 53

  10. varargs, 337

  11. @varargs annotation, 235

  12. variables

    1. binding to values, 221

    2. declaring as Java SAM interfaces, 176

    3. in case clauses, 211212

    4. naming, 150, 212

    5. no dependent types with, 288

    6. package-level, 89

    7. within loops, 2526

  13. variance, 239, 268270

  14. Vector class, 187

  15. vector type (C++), 40

  16. view method

    1. of Iterable, 194

    2. of Iterator, 202

  17. Visual Studio Code, 2

  18. void keyword (C++, Java), 19, 21, 108

  19. @volatile annotation, 236

W

  1. wait method (AnyRef), 107

  2. walk method (java.nio.file.Files), 121

  3. walkFileTree method (Java), 120121

  4. warnings

    1. generated with annotations, 238

    2. suppressing, 238239

  5. while loop, 2325, 179

  6. wildcards, 272273

    1. in catch statements, 34

    2. in imports, 8, 9091, 302

  7. with keyword, 132, 134, 299300

  8. wrapper types, 6

Y

  1. yield keyword

    1. as Java method, 150

    2. in loops, 26, 4243

Z

  1. zip method

    1. for tuples, 59

    2. of Future trait, 254255

    3. of Iterable, 194, 200

    4. of Iterator, 202

  2. zipAll, zipWithIndex methods

    1. of Iterable, 194, 201

    2. of Iterator, 202

  3. zipping, 200201

  4. zipWith method (Future trait), 254255

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.191.214