contents

foreword
preface
acknowledgments
about this book
about the authors
about the cover illustration

Part 1 Developing with Java 7

Chapter 1 Introducing Java 7
The language and the platform
Small is beautiful—Project Coin
The changes in Project Coin
Summary
Chapter 2 New I/O
Java I/O—a history
Path—a foundation of file-based I/O
Dealing with directories and directory trees
Filesystem I/O with NIO.2
Asynchronous I/O operations
Tidying up Socket-Channel functionality
Summary

Part 2 Vital techniques

Chapter 3 Dependency Injection
Inject some knowledge—understanding IoC and DI
Standardized DI in Java
Guice 3—the reference implementation for DI in Java
Summary
Chapter 4 Modern concurrency
Concurrency theory—a primer
Block-structured concurrency (pre-Java 5)
Building blocks for modern concurrent applications
Controlling execution
The fork/join framework
The Java Memory Model (JMM)
Summary
Chapter 5 Class files and bytecode
Classloading and class objects
Using method handles
Examining class files
Bytecode
Invokedynamic
Summary
Chapter 6 Understanding performance tuning
Performance terminology—some basic definitions
A pragmatic approach to performance analysis
What went wrong? Why we have to care
A question of time—from the hardware up
Garbage collection
JIT compilation with HotSpot
Summary

Part 3 Polyglot programming on the JVM

Chapter 7 Alternative JVM languages
Java too clumsy? Them’s fighting words!
Language zoology
Polyglot programming on the JVM
How to choose a non-Java language for your project
How the JVM supports alternative languages
Summary
Chapter 8 Groovy: Java’s dynamic friend
Getting started with Groovy
Groovy 101—syntax and semantics
Differences from Java—traps for new players
Groovy features not (yet) in Java
Interoperating between Groovy and Java
Summary
Chapter 9 Scala: powerful and concise
A quick tour of Scala
Is Scala right for my project?
Making code beautiful again with Scala
Scala’s object model—similar but different
Data structures and collections
Introduction to actors
Summary
Chapter 10 Clojure: safer programming
Introducing Clojure
Looking for Clojure—syntax and semantics
Working with functions and loops in Clojure
Introducing Clojure sequences
Interoperating between Clojure and Java
Concurrent Clojure
Summary

Part 4 Crafting the polyglot project

Chapter 11 Test-driven development
TDD in a nutshell
Test doubles
Introducing ScalaTest
Summary
Chapter 12 Build and continuous integration
Getting started with Maven 3
Maven 3—a quick-start project
Maven 3—the Java7developer build
Jenkins—serving your CI needs
Code metrics with Maven and Jenkins
Leiningen
Summary
Chapter 13 Rapid web development
The problem with Java-based web frameworks
Criteria in selecting a web framework
Getting started with Grails
Grails quick-start project
Further Grails exploration
Getting started with Compojure
A sample Compojure project—“Am I an Otter or Not?”
Summary
Chapter 14 Staying well-grounded
What to expect in Java 8
Polyglot programming
Future concurrency trends
New directions in the JVM
Summary

appendix A Java7developer—source code installation
appendix B Glob pattern syntax and examples
appendix C Installing alternative JVM languages
appendix D Downloading and installing Jenkins
appendix E Java7developer—the Maven POM
                   index