Index

A note on the digital index

A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.

Symbols

" (quotation marks, double)
enclosing string literals, Strings
“"” (triple quotes), for multiline strings, Strings
$ (dollar sign)
referencing external data in string interpolation, String interpolation
& (ampersand)
& (Boolean and) operator, An Overview of Scala Types
&& versus & operator, An Overview of Scala Types
' (quotation marks, single)
enclosing Char literals, An Overview of Scala Types
( ) (parentheses)
defining capture group in regular expressions, Regular expressions
denoting a Unit literal, An Overview of Scala Types
enclosing Boolean expression in if expression, Matching with Pattern Guards
enclosing tuples, Tuples
grouping function parameters, Parameter Groups
in for-loops, Loops
in functions, Functions with Empty Parentheses, Function Invocation with Expression Blocks
leaving out for single-parameter functions, Function Types and Values
* (asterisk)
in vararg parameters, Vararg Parameters
multiplication operator, Naming
-> relation operator, Lists, Sets, and Maps
. (period), member access operator, Naming
. dot notation, Methods and Operators, List Arithmetic
accessing class fields and methods, Defining Classes
/ (slash)
division operator, Option Collections
: (colon)
:: (cons) operator, The Cons Operator
<% view-bound operator, Bounded Types
<: upper-bound relation operator, Bounded Types
<< (left shift operator), Value Binding
= (equals sign)
== (equals) operator, string comparisons, Strings
before procedure body, Procedures
>: lower-bound relation operator, Bounded Types
@annotation.tailrec, Recursive Functions
@param keyword in Scaladoc, Writing Readable Functions
[ ] (square bracets), for type parameterization, Naming
\ (backslash)
escaping special characters in string literals, Strings
_ (underscore)
wildcard operator, Accessing Packaged Classes
`` (backquotes), names enclosed in, Naming
{ } (curly braces)
enclosing expression blocks, Expressions and Conditionals, Expression Blocks
in for-loops, Loops
in if expressions, If-Else Expressions
in references to external data, String interpolation
| (vertical line)
using pipes with pattern alternatives, Match Expressions
|| versus | operator, An Overview of Scala Types
̲ (underscore)
wildcard operator, Matching with Wildcard Patterns
assigning a function with, Function Types and Values
in partially applied functions, Partially Applied Functions and Currying
placeholder syntax in functions, Placeholder Syntax
“classes”
“using with collections”))(((“collections”
“working with classes”), Classes

A

abstract classes, Abstract Classes
subclass extending, Abstract Classes
type declarations in, Abstract Types
abstract types, Abstract Types
declaring using bounded types, Bounded Types
access control
shared by companion object and class, Apply Methods and Companion Objects
access modifiers, Privacy Access Modifiers
accumulative imports, Accessing Packaged Classes
accumulator variable, Reducing Lists
annotations, Recursive Functions
anonymous classes, Anonymous Classes
defining as part of method invocation, Anonymous Classes
anonymous functions, Function Literals
(see also function literals)
Any type, An Overview of Scala Types
as return type for if block, If Expressions
Int type value assigned to, Matching Types with Pattern Variables
Object class and, Classes
AnyRef type, An Overview of Scala Types, Classes
AnyVal type, An Overview of Scala Types
apply methods, Apply Methods
case classes, Case Classes
for objects, Apply Methods and Companion Objects
in classes extending FunctionX, Tuple and Function Value Classes
arithmetic operations, Using the Scala REPL
arithmetic operators, Scala methods as, Methods and Operators
arity, Tuple and Function Value Classes
ArrayBuffer class, Accessing Packaged Classes
arrays
Array type as fixed-size, mutable, indexed collection, Arrays
Java, conversion to Scala Array type, Mapping Lists
arrow syntax in function literals, Function Literals
asInstanceOf method, Type operations
avoiding runtime errors with, Type operations
associative arrays, Lists, Sets, and Maps

B

Boolean expressions, If Expressions
in do/while loops, While and Do/While Loops
in while loops, While and Do/While Loops
Boolean reduction operations, Reducing Lists
Boolean type, An Overview of Scala Types
obtaining Boolean values from comparison and logic operators, An Overview of Scala Types
booleans
no automatic conversion of other types to in Scala, An Overview of Scala Types
bounded types, Bounded Types
using to declare abstract types, Bounded Types
Buffer type, Creating New Mutable Collections
converting to a List, Creating New Mutable Collections
buffers
advantages and drawbacks of Buffer type, Creating Mutable Collections from Immutable Ones
converting immutable collections to, Creating Mutable Collections from Immutable Ones
of 2-sized tuples, converting to a List and a Set, Creating Mutable Collections from Immutable Ones
builders (collection), Using Collection Builders
creating for a specific collection type, Using Collection Builders
use case for, Using Collection Builders
by-name parameters, By-Name Parameters, Invoking Higher-Order Functions with Function Literal Blocks
Byte type, Numeric Data Types
conversion to other types, Numeric Data Types

C

camel case, Naming
capture groups, Regular expressions
case blocks (in match expressions), Match Expressions
pattern alternatives and, Match Expressions
case classes, Case Classes
benefits of, Case Classes
convenience of automatically generated methods, Case Classes
creating, Case Classes
creating and examining automatially generated methods, Case Classes
generated methods for, Case Classes
importing members into current namespace, Importing Instance Members
parent class fields and, Case Classes
TupleX[Y], Tuple and Function Value Classes
case keyword, Case Classes
cat command (Unix), command-line application emulating, Command-Line Applications with Objects
Char type, Values, An Overview of Scala Types
Char literals enclosed in single quotes, An Overview of Scala Types
class files, Packaging, Command-Line Applications with Objects
classes, Types
case classes, Case Classes
class parameters, Classes
declaring a field as class parameter, Classes
defined, Classes
defining, Defining Classes
class parameters, Defining Classes
defining together with objects in .scala files, Apply Methods and Companion Objects
example of simple class, Classes
extending traits, Instantiation with Traits
final and sealed, Final and Sealed Classes
implicit, Advanced Typing, Implicit Classes
importing into current namespace
using import aliases, Accessing Packaged Classes
using import groups, Accessing Packaged Classes
importing members into current namespace, Importing Instance Members
inheritance and polymorphism, Classes
instantiation with traits, Instantiation with Traits
more class types, More Class Types
abstract classes, Abstract Classes
anonymous classes, Anonymous Classes
more field and method types, More Field and Method Types
apply methods, Apply Methods
lazy values in fields, Lazy Values
overloaded methods, Overloaded Methods
objects and, Objects
packaging, Packaging
accessing packaged classes, Accessing Packaged Classes
using packaging syntax, Packaging Syntax
privacy access modifiers, Privacy Access Modifiers
privacy controls, Privacy Controls
static or global fields and methods, Objects
traits, Traits
type parameters, Advanced Typing
collection.immutable package, Creating New Mutable Collections
collection.mutable package, Creating New Mutable Collections
importing into current namespace, Accessing Packaged Classes
collections, Common CollectionsExercises
arrays, Arrays
converting, Converting Collections
Java and Scala collection compatibility, Java and Scala Collection Compatibility
higher-order functions in, Lists, Sets, and Maps
lists, Lists, Sets, and Maps
arithmetic operations on, List Arithmetic
constructing with cons operator, The Cons Operator
creating and manipulating, What’s in a List?
mapping, Mapping Lists
reducing, Reducing Lists
maps, Lists, Sets, and Maps
monadic, Monadic Collections
Future collections, Future CollectionsHandling futures synchronously
Option collections, Option CollectionsExtracting values from Options
Try collections, Try CollectionsTry Collections
mutable, Mutable Collections
creating from immutable collections, Creating Mutable Collections from Immutable Ones
creating new, Creating New Mutable Collections
using collection builders, Using Collection Builders
pattern matching with, Pattern Matching with Collections
return value of expressions with yield keyword, Loops
Seq and sequences, Seq and Sequences
sets, Lists, Sets, and Maps
streams, Streams
colon-and-type format (function definitions), Functions
command-line applications, Command-Line Applications with Objects
creating in Scala, Command-Line Applications with Objects
creating, compiling, and executing, Command-Line Applications with Objects
similarity to pure functions, Command-Line Applications with Objects
comments, Writing Readable Functions
companion objects, Apply Methods and Companion Objects
for case classes, Case Classes
special access controls shared with companion class, Apply Methods and Companion Objects
comparison operators
obtaining Boolean values from, An Overview of Scala Types
compilation
traits and multiple inheritance, Traits
traits with competing members and, Traits
compiled code, reusable, Apply Methods and Companion Objects
compiler, Packaging
compiling Scala source file, Packaging
concurrent.Await.result(), Handling futures synchronously
concurrent.ExecutionContext.Implicits.global, Future Collections, Importing Instance Members
concurrent.Future, importing, Handling futures asynchronously
cons operator, The Cons Operator
for streams, Streams
contravariance, Type Variance, Type Variance
contravariant type parameters, Type Variance
copy method
case classes, Case Classes
covariance, Type Variance
covariant type parameters, Advanced Typing, Type Variance
currying functions, Partially Applied Functions and Currying

D

data types (see types)
Date class
importing, Accessing Packaged Classes
declarative programming, First-Class Functions
default methods, Apply Methods
dependency injection, Instantiation with Traits
dependency problems, reducing with use of pure functions, Objects
dictionaries, Lists, Sets, and Maps
directories for Scala source files, Packaging
do/while loops, While and Do/While Loops
dot notation, Methods and Operators, Defining Classes
versus operator notation in list methods, List Arithmetic
Double type, Working with Data: Literals, Values, Variables, and Types, Numeric Data Types
methods, Methods and Operators
Duration type, Handling futures synchronously

E

else blocks, If..Else Expression Blocks
else if blocks, Scala and, If..Else Expression Blocks
empty collections
Option type providing safe handling of, Option Collections
encapsulation, Classes
equals method
case classes, Case Classes
equals operator (==), Strings
error-handling strategy, Try Collections
event handlers
jQuery-style, Anonymous Classes
exceptions, Try Collections
catching and handling with Try collection, Try Collections
from synchronous futures operations, Handling futures synchronously
function to throw exception based in input criteria, Try Collections
thrown in asynchronous future execution, Handling futures asynchronously
validating numbers stored in strings, Try Collections
ExecutionContext for running functions concurrently, Future Collections
expression blocks, Expressions and Conditionals
function invocation with, Function Invocation with Expression Blocks
expressions, Expressions and ConditionalsExpression Blocks
defined, Expressions and Conditionals
defining values and variables with, Defining Values and Variables with Expressions
expression blocks, Expression Blocks
functions as named wrappers for, Functions
if .. else expression blocks, If..Else Expression Blocks
if .. else expressions, If-Else Expressions
if expressions, If Expressions
in loops, LoopsSummary
match expressions, Match ExpressionsMatching Types with Pattern Variables
multiple, in a case block, Match Expressions
no ternary expressions in Scala, If-Else Expressions
parameterized, function literals as, Function Literals
statements, Statements
extends keyword, Classes
traits added to classes and, Instantiation with Traits
extensions (class), Classes

F

factory pattern, Apply Methods and Companion Objects
Failure type, Try Collections
fields (class), Classes
in abstract classes, Abstract Classes
lazy values, Lazy Values
private, Privacy Controls
protected, Privacy Controls
filter function
using with Option collection, Option Collections
filter() function
in List, List Arithmetic
filters, Iterator Guards
(see also iterator guards)
final classes, Final and Sealed Classes
find operation, Classes
in collections, Option Collections
first-class functions, First-Class FunctionsExercises
by-name parameters, By-Name Parameters
function types and values, Function Types and ValuesFunction Types and Values
higher-order functions, Higher-Order Functions
invoking higher-order functions with function literal blocks, Invoking Higher-Order Functions with Function Literal Blocks
partial functions, Partial Functions
partially applied functions and currying, Partially Applied Functions and Currying
placeholder syntax for function literals, Placeholder Syntax
Float type, Numeric Data Types
floating-point numbers, Numeric Data Types
folds, Reducing Lists, Reducing Lists
order of, Reducing Lists
for comprehensions, Loops
(see also for-loops)
for-loops, Loops
defining with parentheses or curly braces, Loops
iterator guards in, Iterator Guards
nested iterators in, Nested Iterators
using to iterate over lists, Lists, Sets, and Maps
value binding in, Value Binding
yield keyword in, Loops
foreach() function
in List, Lists, Sets, and Maps
forEach() function
in class extending Traversable, Defining Classes
printing out results of parsing a number out of a string, Try Collections
fromFile method, io.Source object, Command-Line Applications with Objects
function annotation
for tail recursion, Recursive Functions
function literals, Function Literals
built with regular classes, Advanced Typing
classes, Tuple and Function Value Classes
comparing with function assignment, Function Literals
conversion to body of apply method in class extending FunctionX, Tuple and Function Value Classes
defined within higher-order function invocations, Function Literals
invoking higher-order functions with, Invoking Higher-Order Functions with Function Literal Blocks
without input arguments, Function Literals
writing with regular syntax and as body of FunctionX.apply method, Tuple and Function Value Classes
function overloading, Parameters with Default Values
function value classes, Tuple and Function Value Classes
function0, function1, function2, .., Function Literals
functional programming, Functions
recursive functions in, Recursive Functions
functions, FunctionsExercises
by-name parameters, By-Name Parameters
calling with named parameters, Calling Functions with Named Parameters
defining a function with a return type, Functions
defining an input-less function, Functions
full function definition, Functions
higher-order, Higher-Order Functions
invoking with function literal blocks, Invoking Higher-Order Functions with Function Literal Blocks
I/O (input/output), Objects
implicit parameters, Implicit Parameters
in Scala, Functions
invocation with expression blocks, Function Invocation with Expression Blocks
nested, Nested Functions
parameter groups, Parameter Groups
partial, Partial Functions
partially applied, Partially Applied Functions and Currying
currying, Partially Applied Functions and Currying
placeholder syntax in function literals, Placeholder Syntax
predicate, List Arithmetic
procedures, Procedures
pure functions as utilities, object providing, Objects
pure, benefits of, Functions
readable
adding comments, Writing Readable Functions
adding Scaladoc headers, Writing Readable Functions
recursive, Recursive Functions
signature, Function Types and Values
type of, Function Types and Values
function with multiple parameters, Function Types and Values
function with no inputs, Function Types and Values
type parameters, Type Parameters, Advanced Typing
vararg parameters, Vararg Parameters
with default values, Parameters with Default Values
with empty parentheses, Functions with Empty Parentheses
writing readable functions, Writing Readable Functions
FunctionX[Y] trait, Tuple and Function Value Classes
Future collections, Future CollectionsHandling futures synchronously
creating a future with function that prints a message, Future Collections
handling futures asynchronously, Handling futures asynchronously
operations to chain futures and set callback functions, Handling futures asynchronously
working with from start to finish (example), Handling futures asynchronously
handling futures synchronously, Handling futures synchronously
using concurrent.Await.result(), Handling futures synchronously

G

getClass method, Type operations
global modifier
class fields and methods, Objects
Google Guice, Instantiation with Traits

H

hashCode method, Type operations
case classes, Case Classes
hashmaps, Lists, Sets, and Maps
headOption method, Option Collections
higher-order functions, First-Class Functions, Higher-Order Functions
available in List and other collections, Lists, Sets, and Maps
in collections
lists, List Arithmetic
invocations of, function literals defined within, Function Literals
invoking with function literal blocks, Invoking Higher-Order Functions with Function Literal Blocks
organizing parameters, Invoking Higher-Order Functions with Function Literal Blocks
invoking with function literals
benefits and uses of, Invoking Higher-Order Functions with Function Literal Blocks

I

I/O (input/output) functions, Objects
identifiers
rules for, Naming
self, in self types, Self Types
identity functions, Type Parameters
IDEs
support for Scaladoc headers for functions, Writing Readable Functions
if .. else expression blocks, If..Else Expression Blocks
if expressions, If Expressions
if..else expressions, If-Else Expressions
if .. else if .. else blocks, If..Else Expression Blocks, Match Expressions
if expressions
in match expression pattern guards, Matching with Pattern Guards
immutable collections, Converting Collections
mutable counterparts to, Creating New Mutable Collections
immutable data, Mutable Collections
imperative programming, First-Class Functions
implicit class, Arrays
implicit classes, Advanced Typing, Implicit Classes
example, Implicit Classes
restrictions on defining and use of, Implicit Classes
implicit conversion, Streams
implicit def methods, Implicit Classes
implicit keyword, Implicit Parameters
implicit parameters, Advanced Typing, Implicit Parameters
import aliases, Accessing Packaged Classes
import collection.JavaConverters command, Java and Scala Collection Compatibility
import groups, Accessing Packaged Classes
import statement, Accessing Packaged Classes
importing instance members into current namespace, Importing Instance Members
importing a packaged class, Accessing Packaged Classes
IndexedSeq type, Loops
infix dot notation, Methods and Operators, Defining Classes
infix operator notation, Methods and Operators
inheritance, Classes
example of, Classes
multiple inheritance enabled with traits, Traits
injector methods, Apply Methods
instance members
importing, Importing Instance Members
instance of a class, Defining Classes
instantiation, Defining Classes
Int type, Values, Numeric Data Types
asssigned to Any, resolving true type with match expression, Matching Types with Pattern Variables
automatic conversion to Double, Variables
converting Long to, using toInt method, Numeric Data Types
invariant type parameters, Type Variance
io.Source object
fromFile method, Command-Line Applications with Objects
isInstanceOf method, Type operations
Iterable type, Common Collections
Array type support for Iterable operations, Arrays
need for, while building mutable collections, Using Collection Builders
iterator guards, Iterator Guards
iterators, Iterator Guards
creating for lists, What’s in a List?
nested, Nested Iterators

J

Java
collections
converting Scala collections to, Java and Scala Collection Compatibility
collections library, Common Collections
interoperability of Scala with, Numeric Data Types
verifying your version, Installing Scala
Java 8 JDK, Installing Scala
java.lang.Object class, Classes
java.util.concurrent.TimeoutException, Handling futures synchronously
java.util.Date class, Accessing Packaged Classes
java.util.Formatter, String interpolation
java.util.regex.Pattern, Regular expressions
JavaConverters, importing, Java and Scala Collection Compatibility
JVM (Java Virtual Machine)
Scala code execution, Future Collections
Scala command-line applications in, Command-Line Applications with Objects
throwing exceptions, Try Collections
traits and multiple inheritance, Traits

K

key-value pairs
in maps, Lists, Sets, and Maps

L

lambda expressions (or lambdas), Function Literals
(see also function literals)
lazy collections, Streams
lazy values, Lazy Values
left shift operator (<<), Value Binding
left-associative notation, The Cons Operator
line comments, Writing Readable Functions
linearization, Traits
benefits of, Traits
multiple inheritance ordering and, Traits
list-folding operations, Reducing Lists
listener class (example), Anonymous Classes
lists, Lists, Sets, and Maps
accessing elements, Lists, Sets, and Maps
arithmetic operations on, List Arithmetic
adding items to end of list, List Arithmetic
constructing with cons operator, The Cons Operator
converting buffer of 2-sized tuples to, Creating Mutable Collections from Immutable Ones
converting mutable collections to, Creating New Mutable Collections
converting other collection types to and from, Converting Collections
covariant type parameters of List, Advanced Typing
creating and manipulating, What’s in a List?
checking for end of a list, What’s in a List?
creating a List iterator, What’s in a List?
empty, head element wrapped in an Option, Option Collections
higher-order functions available in List, Lists, Sets, and Maps
iterating over, using for-loops, Lists, Sets, and Maps
List type, official documentation, List Arithmetic
mapping, Mapping Lists
matching on head and tail elements, Pattern Matching with Collections
reducing, Reducing Lists
Boolean reduction operations, Reducing Lists
creating your own reduction operation, Reducing Lists
list-folding operations, Reducing Lists
retrieving an element by its index, using List.apply(), Apply Methods
Seq as root type, Seq and Sequences
type parameters, Lists, Sets, and Maps
using User class with (example), Classes
literals, Numeric Data Types
assigning to new values without stating type, Numeric Data Types
case-insensitive characters in, Numeric Data Types
Char, An Overview of Scala Types
defined, Working with Data: Literals, Values, Variables, and Types
logical operators
obtaining Boolean values from, An Overview of Scala Types
Long type, Numeric Data Types
converting to Int, using toInt method, Numeric Data Types
loops, LoopsWhile and Do/While Loops
for-loops, Loops
iterator guards in, Iterator Guards
nested iterators in, Nested Iterators
value binding in, Value Binding
while and do/while, While and Do/While Loops
lower bounds, Bounded Types
lower-bound relation operator (>:), Bounded Types

M

map function
using with Option collection, Option Collections
map operations
for-loop as, Loops
map() function, First-Class Functions
in List, Lists, Sets, and Maps
mapping, defined, Mapping Lists
maps, Lists, Sets, and Maps
building, Creating New Mutable Collections
converting mutable collections to, Creating New Mutable Collections
converting other collection types to, Converting Collections
immutable, converting to and from buffers, Creating Mutable Collections from Immutable Ones
mutable and immutable versions of Map, Accessing Packaged Classes
adding both to current namespace, Accessing Packaged Classes
match expressions, Match ExpressionsMatching Types with Pattern Variables
failing to provide matching pattern for input expression, Match Expressions
in partial functions, Partial Functions
matching types with pattern variables, Matching Types with Pattern Variables
matching with pattern guards, Matching with Pattern Guards
matching with wildcard patterns, Matching with Wildcard Patterns
pattern alternative in, Match Expressions
syntax, Match Expressions
taking integer status code and returning appropriate messsage, Match Expressions
using with collections, Pattern Matching with Collections
versus if .. else blocks, Match Expressions
MatchError type, Match Expressions, Partial Functions
methods, Methods and Operators
and operator notation, Methods and Operators
methods with more than one parameter, Methods and Operators
apply methods, Apply Methods
chaining method calls, Methods and Operators
defined, Methods and Operators
for case classes and companion objects
automatically generated methods, Case Classes
implementing abstract method with a value, Abstract Classes
implicit parameters in, Advanced Typing
in abstract classes, Abstract Classes
in case classes and companion objects, Case Classes
inherited, overriding methods in parent class, Classes
object, Objects
overloaded, Overloaded Methods
private, Privacy Controls
protected, Privacy Controls
mkString method, Command-Line Applications with Objects
monadic collections, Monadic Collections
Future, Future CollectionsHandling futures synchronously
Option, Option CollectionsExtracting values from Options
Try, Try CollectionsTry Collections
mutable collections, Mutable Collections
converting to immutable, Creating New Mutable Collections
creating from immutable ones, Creating Mutable Collections from Immutable Ones
creating new, Creating New Mutable Collections
importing all into current namespace, Accessing Packaged Classes
using collection builders, Using Collection Builders

N

named parameters, Calling Functions with Named Parameters
in classes, Defining Classes
placeholders for, Placeholder Syntax
namespaces
duplicate class names in, Accessing Packaged Classes
importing class into current namespace, Accessing Packaged Classes
importing instance members into current namespace, Importing Instance Members
resetting namespace in REPL, Accessing Packaged Classes
scala.Predef object automatically added to, Package Objects
naming conventions, Naming
for packages, Packaging
for pattern variables, Matching Types with Pattern Variables
nested classes, Defining Classes
nested functions, Nested Functions
nested iterators, Nested Iterators
Nil type
lists ending with instance of, What’s in a List?
None type, Option Collections
Nothing type, An Overview of Scala Types
lists and, What’s in a List?
null keyword, An Overview of Scala Types
Null type, An Overview of Scala Types
null values
avoiding a method call on null, Higher-Order Functions
creating Option object with, Option Collections
using a pattern guard to differentiate between nonnull and null response, Matching with Pattern Guards
numeric data types, Numeric Data Types
automatic type conversions, Numeric Data Types
numeric literals, Numeric Data Types

O

Object class, Classes
object-oriented Scala
classes, Classes
abstract, Abstract Classes
anonymous, Anonymous Classes
apply methods, Apply Methods
defining, Defining Classes
final and sealed, Final and Sealed Classes
lazy values in fields, Lazy Values
more class types, More Class Types
more field and method types, More Field and Method Types
overloaded methods in, Overloaded Methods
packaging, Packaging
privacy controls, Privacy Controls
objects, ObjectsCommand-Line Applications with Objects, Types
advantages of using, Command-Line Applications with Objects
and case classes, Case Classes
apply methods and companion objects, Apply Methods and Companion Objects
classes and, Objects
command-line applications with, Command-Line Applications with Objects
defining, Objects
importing members into current namespace, Importing Instance Members
pure functions as utilities, Objects
types having AnyRef as root, An Overview of Scala Types
using for writing functions, Case Classes
operator notation, Methods and Operators
benefits and drawbacks of, Methods and Operators
versus dot notation in list methods, List Arithmetic
operators, Naming
left-associative and right-associative notation, The Cons Operator
Option collections, Option CollectionsExtracting values from Options
defining a function that returns an Option value, Option Collections
extracting values from, Extracting values from Options
avoiding Option.get(), Extracting values from Options
safe extraction methods, Extracting values from Options
sealed Option class, Final and Sealed Classes
type-safe option for handling function results, Option Collections
use in find operation, Option Collections
orElse operation, Try collection, Try Collections
overloaded methods, Overloaded Methods
override keyword, Classes, Traits

P

package keyword, Packaging, Package Objects
package objects, Package Objects
package.scala files, Package Objects
packages, Packaging
accessing classes in, Accessing Packaged Classes
creating a source file with a package and compiling it, Packaging
defining a package for a Scala file, Packaging
importing entire contents of, Accessing Packaged Classes
importing part of, Accessing Packaged Classes
importing parts of, using import groups, Accessing Packaged Classes
naming, Packaging
packaging syntax, Packaging Syntax
using packaging syntax
nesting packages, Packaging Syntax
parameters (class), Classes, Defining Classes
classes extending classes with parameters, Defining Classes
defining default values for, Defining Classes
named parameters, Defining Classes
type parameters, Defining Classes
parameters (function)
@param keyword in Scaladoc, Writing Readable Functions
by-name, By-Name Parameters
grouped, Parameter Groups
implicit, Implicit Parameters
in higher-order function invoked with function literal block, Invoking Higher-Order Functions with Function Literal Blocks
in overloaded methods, Overloaded Methods
named, Calling Functions with Named Parameters
type parameters, Type Parameters
vararg, Vararg Parameters
with default values, Parameters with Default Values
parent class
extending, traits and, Traits
partial functions, Partial Functions
match expressions as, Partial Functions
versus partially applied functions, Partial Functions
partially applied functions, Implicit Parameters
currying, Partially Applied Functions and Currying
partially applying functions, Partially Applied Functions and Currying
partition() function
in List, List Arithmetic
paste mode, raw (in REPL), Packaging Syntax
pattern alternatives, Match Expressions
pattern guards, Matching with Pattern Guards, Pattern Matching with Collections
pattern matching, Match Expressions
(see also match expressions)
with collections, Pattern Matching with Collections
pattern variables, Matching Types with Pattern Variables
performance
appending items to the end of lists, List Arithmetic
placeholder syntax, Placeholder Syntax
in collection methods that are higher-order functions, List Arithmetic
ordering of placeholders, Placeholder Syntax
working with data structures and collections, Placeholder Syntax
polymorphic types, Matching Types with Pattern Variables
polymorphism, Classes
example of, Type Variance
of classes in Scala, example of, Classes
Predef object, Implicit Classes, Package Objects
predicate functions, List Arithmetic
primitive types, Scala and, Types
printf function
using printf formatting to control data formatting, String interpolation
println statement, Match Expressions
println() function, Using the Scala REPL
privacy access modifiers, Privacy Access Modifiers
privacy controls, Privacy Controls
imports of members and, Importing Instance Members
private keyword, Privacy Controls
access modifiers with, Privacy Access Modifiers
private modifier
private companion object members, access by companion class, Apply Methods and Companion Objects
procedures, Procedures
defining, Procedures
ProductX traits, Tuple and Function Value Classes
protected keyword, Privacy Controls
access modifiers with, Privacy Access Modifiers
pure functions, Functions, Objects
referential transparency test, Objects
similarity of command-line applications to, Command-Line Applications with Objects

R

r operator, converting a string to a regular expression type, Regular expressions
range comments, Writing Readable Functions
Range type
creating a numeric range, Loops
recursive functions, Recursive Functions
iterating a list, What’s in a List?
reduce() function, First-Class Functions
in list, Lists, Sets, and Maps
reduction operations
reducing a collection to a single Option, Option Collections
reference types, An Overview of Scala Types
referential transparency test, Objects
regular expressions, Regular expressions
converting string types to, Regular expressions
String type operations supporting, Regular expressions
relation operator (-&#x3e);, Lists, Sets, and Maps
REPL (Read-Eval-Print-Loop) shell, Using the Scala REPL
defining a value, Working with Data: Literals, Values, Variables, and Types
Hello, World application, Using the Scala REPL
paste mode, Apply Methods and Companion Objects
raw paste mode for packages, Packaging Syntax
resetting session and namespace, Accessing Packaged Classes
res (result) variables, Using the Scala REPL
using, Working with Data: Literals, Values, Variables, and Types
reserved words, Reserved WordsReserved Words
return keyword, Functions
return type of Nothing, An Overview of Scala Types
return type
of functions, Functions
right-associative notation, The Cons Operator

S

Scala
background, Getting Started with the Scalable Language
installing, Installing Scala
interoperability with Java, Numeric Data Types
reasons for learning, Why Learn Scala (or, Why Should You Read “Learning Scala”)?
REPL (Read-Eval-Print-Loop), Using the Scala REPL
Scala API Documentation, Methods and Operators
scala command, Installing Scala
.scala files, defining classes and objects together in, Apply Methods and Companion Objects
Scala Language Specification, Naming, Function Literals
scala.language.implicitConversions() method, Implicit Classes
scala.Predef object, Package Objects
SCAlable LAnguage (see Scala)
scalac command, Packaging
Scaladoc comments, Writing Readable Functions
scalar values, Type operations
scals.Predef object, Implicit Classes
sealed classes, Final and Sealed Classes
self types, Self Types
and classes instantiated with traits, Instantiation with Traits
benefits of using with traits, Self Types
in trait definitions, Self Types
restrictions added to traits, Self Types
sequences
Seq hierarchy of sequence collections, Seq and Sequences
Seq type and, Seq and Sequences
sets
building, Creating New Mutable Collections
converting buffer of 2-sizes tuples to, Creating Mutable Collections from Immutable Ones
converting mutable collections to, Creating New Mutable Collections
converting other collection types to, Converting Collections
converting to and from buffers, Creating Mutable Collections from Immutable Ones
creating with a builder, Using Collection Builders
Set type, Lists, Sets, and Maps
Short type, Numeric Data Types
side effects, Expressions and Conditionals
functions with, defining with parentheses, Functions with Empty Parentheses
singletons, Objects
size method, Lists, Sets, and Maps
Some type, Option Collections
sortBy() function
in List, List Arithmetic
source files, Packaging
Spring framework, Instantiation with Traits
Stack Overflow error, Recursive Functions
statements, Statements
functions (or procedures) ending in, Procedures
if blocks as, If Expressions
static modifier
for class fields and methods, Objects
stdout stream, Using the Scala REPL
Stream.Empty, Streams
streams
creating a bounded stream, Streams
example function building and recursively generating a new stream, Streams
Stream type as lazy collection, Streams
Stream.cons and cons operator for streams, Streams
string interpolation functions, vararg parameters, Vararg Parameters
String type, Values, Strings, An Overview of Scala Types
documentation, Methods and Operators
String.endsWith() method, Methods and Operators
strings
converting collections to, Converting Collections
string interpolation, String interpolation
string literals and string values, Function Literals
String type as sequence collection, Seq and Sequences
String type as subtype of Iterable and as java.lang.String wrapper, Seq and Sequences
String variable assigned to null, An Overview of Scala Types
toString method, Type operations
using regular expressions with, Regular expressions
converting a string to a regular expression type, Regular expressions
subclasses
polymorphism and compatible classes, Classes
sublclasses
restricting creation of with final classes, Final and Sealed Classes
Success type, Try Collections
super keyword, Classes
supertypes, An Overview of Scala Types
switch statements (in Java and C), Match Expressions
syntax notation in this book, About the Syntax Notation in This Book

T

tail recursion, Recursive Functions
this keyword, Classes
threads
blocking whle wating for background thread to complete, Handling futures synchronously
running background tasks in concurrent threads, Future Collections
synchronous or asynchronous execution, Future Collections
Thread.sleep, Future Collections
Thread.sleep()
avoiding due to inefficiencies, Handling futures asynchronously
TimeoutException, Handling futures synchronously
to operator, Loops
to<Type> method, Type operations
toString method, Type operations, Classes
arrays and, Arrays
case classes, Case Classes
List type, Classes
traits, Traits, Types
classes instantiated with, Instantiation with Traits
defining, Traits
extending a second trait, Traits
FunctionX[Y], Tuple and Function Value Classes
instantiation with, Instantiation with Traits
linearization process and, Traits
self types, Self Types
adding restrictions to traits, Self Types
benefits of using, Self Types
TupleX[Y] case class extending ProductX trait, Tuple and Function Value Classes
type alias with unspecified type, Abstract Types
type parameters, Advanced Typing
with competing members, Traits
writing to override behavior of a shared parent class, Traits
Traversable type, Defining Classes
Try collections, Try CollectionsTry Collections
error handling methods, Try Collections
handling exceptions when parsing a number from a string, Try Collections
Success and Failure subtypes, Try Collections
Try returned by asynchronous future execution, Handling futures asynchronously
try {} .. catch {}+ blocks, Try Collections
tuples, Tuples
classes, Tuple and Function Value Classes
creating by instantiating Tuple2 case class, Tuple and Function Value Classes
high-level, built with regular classes, Advanced Typing
pattern matching and value binding support, Pattern Matching with Collections
specifying Map key-value pairs as, Lists, Sets, and Maps
type aliases for, Type Aliases
TupleX[Y] case class, Tuple and Function Value Classes
type declarations in abstract classes, creating with abstract types, Abstract Types
type inference, Values, Type Parameters
determining return type for if block, If Expressions
in function literal definitions, Function Literals
with instances, Classes
types, Types, Advanced Typing, TypesPackage Objects
(see also typing, advanced)
abstract, Abstract Types
assigning literals without stating type, Numeric Data Types
automatic conversions, Variables
not allowed from higher ranked to lower ranked types, Numeric Data Types
bounded, Bounded Types
defined, Working with Data: Literals, Values, Variables, and Types
defining value with type incompatible with initial value, Values
function, First-Class Functions
in variable definitions, Variables
leaving out type in value definitions, Values
matching with pattern variables in match expressions, Matching Types with Pattern Variables
numeric, Numeric Data Types
automatic conversions to other types, Numeric Data Types
operations available to all types, Type operations
overview of core types, An Overview of Scala TypesAn Overview of Scala Types
Scala type hierarchy, An Overview of Scala Types
package objects, Package Objects
return type of functions, Functions
Sting, Strings
type aliases, Type Aliases
type parameters, Advanced Typing
in class definitions, Defining Classes
type parameters in collections, Lists, Sets, and Maps
maps, Lists, Sets, and Maps
type parameters in functions, Type Parameters, Placeholder Syntax, Invoking Higher-Order Functions with Function Literal Blocks
type variance, Type Variance
typing, advanced, Advanced Typing
high-level tuples and function literals built with regular classes, Advanced Typing
implicit classes, Advanced Typing
implicit parameters, Advanced Typing, Implicit Parameters
tuple and function value classes, Tuple and Function Value Classes
type parameters and types, Advanced Typing
types, TypesPackage Objects

U

unapply method, case classes, Case Classes
Unit type, An Overview of Scala Types
denoting lack of data, An Overview of Scala Types
return type for procedures, Procedures
statement return values, Statements
until operator, Loops
upper bounds, Bounded Types
util.matching.Regex, Regular expressions
util.Try monadic collection, Try Collections

W

while loops, While and Do/While Loops
list iterator built with, What’s in a List?
wildcard operator (_), Function Types and Values
importing entire package contents with, Accessing Packaged Classes
wildcard operator (̲), Matching with Wildcard Patterns
in partially applied functions, Partially Applied Functions and Currying
placeholder syntax in function literals, Placeholder Syntax
wildcard patterns in match expressions, Matching with Wildcard Patterns
with keyword, Traits, Instantiation with Traits

Y

yield keyword, Loops
converting for-loop into expression returning a collection, Loops