0%

Book Description

Save time and trouble building object-oriented, functional, and concurrent applications with Scala 3. The latest edition of this comprehensive cookbook is packed with more than 250 ready-to-use recipes and 700 code examples to help you solve the most common problems when working with Scala and its popular libraries.

Whether you’re working on web, big data, or distributed applications, this cookbook provides recipes based on real-world scenarios for experienced Scala developers and for programmers just learning to use this JVM language. Author Alvin Alexander includes practical solutions from his experience using Scala for highly scalable applications that support concurrency and distribution.

Recipes cover:

  • Strings, numbers, and control structures
  • Classes, methods, objects, traits, packaging, and imports
  • Functional programming in a variety of situations
  • Building Scala applications with sbt
  • Collections covering Scala’s wealth of classes and methods
  • Actors and concurrency
  • List, array, map, set, and more
  • Files, processes, and command-line tasks
  • Web services and interacting with Java
  • Databases and persistence, data types and idioms

Table of Contents

  1. Strings
    1. 1.1. Testing String Equality
    2. 1.2. Creating Multiline Strings
    3. 1.3. Splitting Strings
    4. 1.4. Substituting Variables into Strings
    5. 1.5. Formatting String Output
    6. 1.6. Processing a String One Character at a Time
    7. 1.7. Finding Patterns in Strings
    8. 1.8. Replacing Patterns in Strings
    9. 1.9. Extracting Parts of a String That Match Patterns
    10. 1.10. Accessing a Character in a String
    11. 1.11. How to Create Your Own String Interpolator
    12. 1.12. Creating Random Strings
  2. Numbers and Dates
    1. 2.1. Parsing a Number from a String
    2. 2.2. Converting Between Numeric Types (Casting)
    3. 2.3. Overriding the Default Numeric Type
    4. 2.4. Replacements for ++ and −−
    5. 2.5. Comparing Floating-Point Numbers
    6. 2.6. Handling Large Numbers
    7. 2.7. Generating Random Numbers
    8. 2.8. Creating a Range or Sequence of Numbers
    9. 2.9. Formatting Numbers and Currency
    10. 2.10. Creating New Date and Time Instances
    11. 2.11. Calculating The Difference Between Two Dates
    12. 2.12. Formatting Dates
    13. 2.13. Parsing Strings Into Dates
    14. 2.14. Converting To/From Legacy Date/Time Classes
52.14.126.74