Programming In Scala A Comprehensive Step By Guide, Third Edition Martin Odersky
User Manual:
Open the PDF directly: View PDF
Page Count: 592 [warning: Documents this large are best viewed by clicking the View PDF Link!]
- Praise for the earlier editions of Programming in Scala
- Table of Contents
- Foreword
- Acknowledgments
- Introduction
- A Scalable Language
- First Steps in Scala
- Next Steps in Scala
- STEP 7. PARAMETERIZE ARRAYS WITH TYPES
- STEP 8. USE LISTS
- WHY NOT APPEND TO LISTS?
- STEP 9. USE TUPLES
- ACCESSING THE ELEMENTS OF A TUPLE
- STEP 10. USE SETS AND MAPS
- Listing 3.5 - Creating, initializing, and using an immutable set.
- Figure 3.2 - Class hierarchy for Scala sets.
- Listing 3.6 - Creating, initializing, and using a mutable set.
- Figure 3.3 - Class hierarchy for Scala maps.
- Listing 3.7 - Creating, initializing, and using a mutable map.
- Listing 3.8 - Creating, initializing, and using an immutable map.
- STEP 11. LEARN TO RECOGNIZE THE FUNCTIONAL STYLE
- A BALANCED ATTITUDE FOR SCALA PROGRAMMERS
- STEP 12. READ LINES FROM A FILE
- CONCLUSION
- Chapter 4
- Classes and Objects
- Basic Types and Operations
- 5.1 SOME BASIC TYPES
- 5.2 LITERALS
- FAST TRACK FOR JAVA PROGRAMMERS
- 5.3 STRING INTERPOLATION
- 5.4 OPERATORS ARE METHODS
- ANY METHOD CAN BE AN OPERATOR
- FAST TRACK FOR JAVA PROGRAMMERS
- 5.5 ARITHMETIC OPERATIONS
- 5.6 RELATIONAL AND LOGICAL OPERATIONS
- 5.7 BITWISE OPERATIONS
- 5.8 OBJECT EQUALITY
- HOW SCALA'S == DIFFERS FROM JAVA'S
- 5.9 OPERATOR PRECEDENCE AND ASSOCIATIVITY
- 5.10 RICH WRAPPERS
- 5.11 CONCLUSION
- Chapter 6
- Functional Objects
- 6.1 A SPECIFICATION FOR CLASS RATIONAL
- 6.2 CONSTRUCTING A RATIONAL
- IMMUTABLE OBJECT TRADE-OFFS
- 6.3 REIMPLEMENTING THE TOSTRING METHOD
- 6.4 CHECKING PRECONDITIONS
- 6.5 ADDING FIELDS
- 6.6 SELF REFERENCES
- 6.7 AUXILIARY CONSTRUCTORS
- 6.8 PRIVATE FIELDS AND METHODS
- 6.9 DEFINING OPERATORS
- 6.10 IDENTIFIERS IN SCALA
- 6.11 METHOD OVERLOADING
- 6.12 IMPLICIT CONVERSIONS
- 6.13 A WORD OF CAUTION
- 6.14 CONCLUSION
- Chapter 7
- Built-in Control Structures
- 7.1 IF EXPRESSIONS
- 7.2 WHILE LOOPS
- 7.3 FOR EXPRESSIONS
- 7.4 EXCEPTION HANDLING WITH TRY EXPRESSIONS
- 7.5 MATCH EXPRESSIONS
- 7.6 LIVING WITHOUT BREAK AND CONTINUE
- 7.7 VARIABLE SCOPE
- FAST TRACK FOR JAVA PROGRAMMERS
- 7.8 REFACTORING IMPERATIVE-STYLE CODE
- 7.9 CONCLUSION
- Chapter 8
- Functions and Closures
- Control Abstraction
- Composition and Inheritance
- 10.1 A TWO-DIMENSIONAL LAYOUT LIBRARY
- 10.2 ABSTRACT CLASSES
- 10.3 DEFINING PARAMETERLESS METHODS
- 10.4 EXTENDING CLASSES
- 10.5 OVERRIDING METHODS AND FIELDS
- 10.6 DEFINING PARAMETRIC FIELDS
- 10.7 INVOKING SUPERCLASS CONSTRUCTORS
- 10.8 USING OVERRIDE MODIFIERS
- 10.9 POLYMORPHISM AND DYNAMIC BINDING
- 10.10 DECLARING FINAL MEMBERS
- 10.11 USING COMPOSITION AND INHERITANCE
- 10.12 IMPLEMENTING ABOVE, BESIDE, AND TOSTRING
- 10.13 DEFINING A FACTORY OBJECT
- 10.14 HEIGHTEN AND WIDEN
- 10.15 PUTTING IT ALL TOGETHER
- 10.16 CONCLUSION
- Chapter 11
- Scala's Hierarchy
- Traits
- Packages and Imports
- 13.1 PUTTING CODE IN PACKAGES
- 13.2 CONCISE ACCESS TO RELATED CODE
- 13.3 IMPORTS
- SCALA'S FLEXIBLE IMPORTS
- 13.4 IMPLICIT IMPORTS
- 13.5 ACCESS MODIFIERS
- 13.6 PACKAGE OBJECTS
- 13.7 CONCLUSION
- Chapter 14
- Assertions and Tests
- Case Classes and Pattern Matching
- 15.1 A SIMPLE EXAMPLE
- 15.2 KINDS OF PATTERNS
- 15.3 PATTERN GUARDS
- 15.4 PATTERN OVERLAPS
- 15.5 SEALED CLASSES
- 15.6 THE OPTION TYPE
- 15.7 PATTERNS EVERYWHERE
- 15.8 A LARGER EXAMPLE
- 15.9 CONCLUSION
- Chapter 16
- Working with Lists
- 16.1 LIST LITERALS
- 16.2 THE LIST TYPE
- 16.3 CONSTRUCTING LISTS
- 16.4 BASIC OPERATIONS ON LISTS
- 16.5 LIST PATTERNS
- ABOUT PATTERN MATCHING ON LISTS
- 16.6 FIRST-ORDER METHODS ON CLASS LIST
- Concatenating two lists
- The Divide and Conquer principle
- Taking the length of a list: length
- Accessing the end of a list: init and last
- Reversing lists: reverse
- Prefixes and suffixes: drop, take, and splitAt
- Element selection: apply and indices
- Flattening a list of lists: flatten
- Zipping lists: zip and unzip
- Displaying lists: toString and mkString
- Converting lists: iterator, toArray, copyToArray
- Example: Merge sort
- THE FAST TRACK
- 16.7 HIGHER-ORDER METHODS ON CLASS LIST
- 16.8 METHODS OF THE LIST OBJECT
- 16.9 PROCESSING MULTIPLE LISTS TOGETHER
- THE FAST TRACK
- 16.10 UNDERSTANDING SCALA'S TYPE INFERENCE ALGORITHM
- 16.11 CONCLUSION
- Chapter 17
- Working with Other Collections
- Mutable Objects
- Type Parameterization
- Abstract Members
- 20.1 A QUICK TOUR OF ABSTRACT MEMBERS
- 20.2 TYPE MEMBERS
- 20.3 ABSTRACT VALS
- 20.4 ABSTRACT VARS
- 20.5 INITIALIZING ABSTRACT VALS
- LAZY FUNCTIONAL LANGUAGES
- 20.6 ABSTRACT TYPES
- 20.7 PATH-DEPENDENT TYPES
- 20.8 REFINEMENT TYPES
- 20.9 ENUMERATIONS
- 20.10 CASE STUDY: CURRENCIES
- 20.11 CONCLUSION
- Chapter 21
- Implicit Conversions and Parameters
- Implementing Lists
- For Expressions Revisited
- Collections in Depth
- 24.1 MUTABLE AND IMMUTABLE COLLECTIONS
- 24.2 COLLECTIONS CONSISTENCY
- 24.3 TRAIT TRAVERSABLE
- 24.4 TRAIT ITERABLE
- 24.5 THE SEQUENCE TRAITS SEQ, INDEXEDSEQ, AND LINEARSEQ
- 24.6 SETS
- 24.7 MAPS
- 24.8 CONCRETE IMMUTABLE COLLECTION CLASSES
- 24.9 CONCRETE MUTABLE COLLECTION CLASSES
- 24.10 ARRAYS
- 24.11 STRINGS
- 24.12 PERFORMANCE CHARACTERISTICS
- 24.13 EQUALITY
- 24.14 VIEWS
- 24.15 ITERATORS
- 24.16 CREATING COLLECTIONS FROM SCRATCH
- 24.17 CONVERSIONS BETWEEN JAVA AND SCALA COLLECTIONS
- 24.18 CONCLUSION
- Chapter 25
- The Architecture of Scala Collections
- Extractors
- Working with XML
- Modular Programming Using Objects
- Object Equality
- 30.1 EQUALITY IN SCALA
- 30.2 WRITING AN EQUALITY METHOD
- 30.3 DEFINING EQUALITY FOR PARAMETERIZED TYPES
- 30.4 RECIPES FOR EQUALS AND HASHCODE
- 30.5 CONCLUSION
- Chapter 31
- Combining Scala and Java
- Futures and Concurrency
- 32.1 TROUBLE IN PARADISE
- 32.2 ASYNCHRONOUS EXECUTION AND TRYS
- 32.3 WORKING WITH FUTURES
- Transforming Futures with map
- Transforming Futures with for expressions
- Creating the Future: Future.failed, Future.successful, Future.fromTry, and Promises
- Filtering: filter and collect
- Dealing with failure: failed, fallBackTo, recover, and recoverWith
- Mapping both possibilities: transform
- Combining futures: zip, Future.fold, Future.reduce, Future.sequence, and Future.traverse
- Performing side-effects: foreach, onComplete, and andThen
- Other methods added in 2.12: flatten, zipWith, and transformWith
- 32.4 TESTING WITH FUTURES
- 32.5 CONCLUSION
- Chapter 33
- Combinator Parsing
- 33.1 EXAMPLE: ARITHMETIC EXPRESSIONS
- 33.2 RUNNING YOUR PARSER
- 33.3 BASIC REGULAR EXPRESSION PARSERS
- 33.4 ANOTHER EXAMPLE: JSON
- 33.5 PARSER OUTPUT
- TURNING OFF SEMICOLON INFERENCE
- CHOOSING BETWEEN SYMBOLIC AND ALPHABETIC NAMES
- 33.6 IMPLEMENTING COMBINATOR PARSERS
- 33.7 STRING LITERALS AND REGULAR EXPRESSIONS
- 33.8 LEXING AND PARSING
- 33.9 ERROR REPORTING
- 33.10 BACKTRACKING VERSUS LL(1)
- 33.11 CONCLUSION
- Chapter 34
- GUI Programming
- The SCells Spreadsheet
- Scala Scripts on Unix and Windows
- Glossary
- Bibliography
- About the Authors