Java 8 in Action cover

Java 8 in Action

Rating 4.5
Word count
552K words
Chapters
40
Series
Turing Programmers Series · Java
ISBN
9787115419347

Tags

Summary

Java 8 in Action is the Chinese translation of Java 8 in Action: Lambdas, Streams, and Functional-Style Programming, translated by Lu Minggang and Lao Jia and published by Posts & Telecom Press in April 2016 as part of the Turing Programmers Series (Java). The book centers on the core changes introduced by Java 8, a milestone release: passing code as data through behavior parameterization; replacing verbose anonymous classes with lambda expressions and method references; using the Stream API to filter, map, reduce, group, and partition declaratively; evolving APIs with default methods without breaking existing implementations; replacing ubiquitous null checks with Optional; composing asynchronous flows with CompletableFuture; and fixing the flaws of the old Date/Calendar classes with the new java.time date-time API. The book has four parts: Fundamentals (Chapters 1–3, explaining why Java 8 matters, behavior parameterization, and lambdas); Functional Data Processing (Chapters 4–7, streams, collectors, parallel streams and the fork/join framework, and Spliterator); Effective Java 8 Programming (Chapters 8–12, refactoring, testing, and debugging, default methods, Optional, CompletableFuture, and the new date-time API); and Beyond Java 8 (Chapters 13–16, functional thinking and techniques, comparison with Scala, and the future of Java). Running examples thread through the book, from filtering apples and traders and transactions to an online discount service, grounding abstract concepts in code that readers can apply immediately to refactor existing projects.

Editor's review

很多Java 8新特性的资料都只讲到“语法怎么写”,而这本书讲的是“为什么这么设计、什么时候该用、什么时候会踩坑”。三位作者背景扎实:厄马是剑桥计算机博士、Cambridge Coding Academy联合创始人,富斯科是Red Hat高级工程师、Drools规则引擎核心开发者,米克罗夫特是剑桥计算机实验室教授、树莓派基金会联合创始人和理事——理论深度与工程落地的两端都占住了。 结构安排相当友好:先用一个“筛选苹果”的例子把行为参数化讲透,再自然过渡到Lambda与方法引用,读者几乎感觉不到概念的跳跃;流的中间操作与终端操作、收集器的分组分区、并行流的正确用法,都配了可以直接跑的代码。第三部分更贴近真实工作:如何把匿名类逐步重构为方法引用、如何测试和调试含Lambda的代码、如何用Optional和CompletableFuture改造旧的null检查与阻塞式调用。 对于仍在维护Java 8代码库的团队,这本书的意义不只是学新语法,而是提供一套可以落地到代码评审里的现代化写法。豆瓣9.1分、七百余人评价,多年稳居Java进阶书单前列,属于买了不会后悔的技术书。

Who it's for

A good fit for

  • 已有Java基础语法、想系统补上Java 8新特性的初中级开发者
  • 公司代码库仍在Java 8、需要重构遗留代码的工程师
  • 准备面试中被频繁问及Lambda、Stream、Optional的程序员
  • 想把命令式代码转向函数式风格的架构师与技术负责人

Not a good fit for

  • 完全没有Java基础、连集合与接口都不熟悉的入门读者
  • 只想学Java 17或更高版本最新特性的读者,可改看本书的更新版本
  • 期待纯理论语言学研究而非工程实践的读者

Reading tips

  1. 建议边读边敲代码:把书中苹果筛选、交易员交易等例子亲手重构成Lambda与Stream版本
  2. 第一至三章务必读透,行为参数化是理解全书后续内容的基础
  3. 第三部分的第8章可对照自己的项目做一次小范围重构实践
  4. 第四部分可视兴趣选读,初读可先跳过Scala比较一章

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Part 1 Fundamentals
  2. Chapter 1 Why Care About Java 8
  3. 1.1 Java Keeps Changing
  4. 1.2 Functions in Java
  5. 1.3 Streams
  6. 1.4 Default Methods
  7. 1.5 Other Good Ideas from Functional Programming
  8. 1.6 Summary
  9. Chapter 2 Passing Code Through Behavior Parameterization
  10. 2.1 Coping with Changing Requirements
  11. 2.2 Behavior Parameterization
  12. 2.3 Tackling Verbosity
  13. 2.4 Real-World Examples
  14. 2.5 Summary
  15. Chapter 3 Lambda Expressions
  16. 3.1 Lambdas in a Nutshell
  17. 3.2 Where and How to Use Lambdas
  18. 3.3 Putting Lambdas into Practice: The Execute-Around Pattern
  19. 3.4 Using Functional Interfaces
  20. 3.5 Type Checking, Type Inference, and Restrictions
  21. 3.6 Method References
  22. 3.7 Lambdas and Method References in Practice
  23. 3.8 Useful Methods for Composing Lambdas
  24. 3.9 Similar Ideas in Mathematics
  25. 3.10 Summary
  26. Part 2 Functional Data Processing
  27. Chapter 4 Introducing Streams
  28. Chapter 5 Working with Streams
  29. Chapter 6 Collecting Data with Streams
  30. Chapter 7 Parallel Data Processing and Performance
  31. Part 3 Effective Java 8 Programming
  32. Chapter 8 Refactoring, Testing, and Debugging
  33. Chapter 9 Default Methods
  34. Chapter 10 Replacing null with Optional
  35. Chapter 11 CompletableFuture: Composable Asynchronous Programming
  36. Chapter 12 The New Date and Time API
  37. Part 4 Beyond Java 8
  38. Chapter 13 Functional Thinking
  39. Chapter 14 Techniques of Functional Programming
  40. Chapter 15 Mixing Object-Oriented and Functional Programming: Java 8 vs. Scala

FAQ

这本书适合零基础学Java的人吗?
不太适合。本书默认读者熟悉Java基本语法、集合与接口,直接讲Lambda和流,零基础读者容易卡在示例代码上。建议先完成一本Java入门书,再用本书专门攻Java 8新特性。
这本书讲的Java 8特性和新版JDK还通用吗?
通用。Lambda、Stream、Optional、默认方法、CompletableFuture、java.time这些核心内容在Java 11、17、21中都保留并延续,只是新版本另有新特性。本书仍是理解这些基础机制的可靠材料。
豆瓣评分和页数是多少?
人民邮电出版社2016年4月版,349页,定价79元,ISBN 9787115419347,豆瓣评分约9.1(七百余人评价)。
这本书和《Java实战(第2版)》是什么关系?
本书译自《Java 8 in Action》;后续版本《Modern Java in Action》中译本名为《Java实战(第2版)》,覆盖到Java 9及之后的特性,内容有较大扩充。若项目已升级到新版本,可优先考虑后者。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category