xiv Contents
Specialized Operators ��������������������������������������������������������������������������������������������������������������� 419
Spread Operator ������������������������������������������������������������������������������������������������������������������������������������������������ 419
Elvis Operator ���������������������������������������������������������������������������������������������������������������������������������������������������� 419
Safe Navigation/Dereference Operator �������������������������������������������������������������������������������������������������������������� 420
Field Operator ���������������������������������������������������������������������������������������������������������������������������������������������������� 421
Method Closure Operator ����������������������������������������������������������������������������������������������������������������������������������� 421
Diamond Operator ��������������������������������������������������������������������������������������������������������������������������������������������� 422Summary ����������������������������������������������������������������������������������������������������������������������������������� 422
■ Appendix C: Introduction to Scala ��������������������������������������������������������������������������������� 423
Getting Started with Scala �������������������������������������������������������������������������������������������������������� 423
Using the Interactive Interpreter ������������������������������������������������������������������������������������������������������������������������ 423
Executing Scala Code as a Script ���������������������������������������������������������������������������������������������������������������������� 424
Compiling Scala Code ���������������������������������������������������������������������������������������������������������������������������������������� 424Variables ������������������������������������������������������������������������������������������������������������������������������������ 426
Collections ��������������������������������������������������������������������������������������������������������������������������������� 426
Lists ������������������������������������������������������������������������������������������������������������������������������������������������������������������� 427
Sets�������������������������������������������������������������������������������������������������������������������������������������������������������������������� 428
Maps ������������������������������������������������������������������������������������������������������������������������������������������������������������������ 428Classes �������������������������������������������������������������������������������������������������������������������������������������� 429
Extending a Class ���������������������������������������������������������������������������������������������������������������������������������������������� 429Traits ������������������������������������������������������������������������������������������������������������������������������������������ 431
Singleton Objects ���������������������������������������������������������������������������������������������������������������������� 432
Summary ����������������������������������������������������������������������������������������������������������������������������������� 433
Index ��������������������������������������������������������������������������������������������������������������������������������� 435