Java 8 in Action cover

Java 8 in Action

Rating 4.5
Word count
552K words
Chapters
24
Series
Turing Programming Series · Java
ISBN
9787115419347

Tags

Summary

Java 8 in Action is the Simplified Chinese edition of Manning's Java 8 in Action, translated by Lu Minggang and Lao Jia and published by Posts & Telecom Press in its Turing Programming Series · Java. Centered on Java 8, a landmark release, the book systematically explains its core new features—lambda expressions, method references, the Stream API, default methods, Optional, CompletableFuture, and the new date-time API—and illustrates them throughout with Java code examples drawn from real business scenarios, showing how a functional style can produce programs that are more concise, easier to maintain, and able to exploit multiple cores automatically. The book has 16 chapters in four parts. Part 1, Fundamentals, begins with why Java is still evolving and introduces behavior parameterization and passing code, then lambda expressions. Part 2, Functional-Style Data Processing, covers the introduction and use of streams, collecting data with streams, and parallel data processing and performance. Part 3, Efficient Java 8 Programming, addresses refactoring, testing, and debugging; default methods; replacing null with Optional; composable asynchronous programming with CompletableFuture; and the new date and time API. Part 4, Beyond Java 8, discusses functional thinking, functional programming techniques, and blending object-oriented and functional programming (comparing Java 8 with Scala), and looks ahead to Java's future. Four appendices cover updates to the language and class libraries, performing multiple operations concurrently on the same stream, and lambdas and JVM bytecode. Each chapter ends with a summary and a quiz for checking understanding along the way, making the book a standard reference for Java developers seeking a systematic grasp of Java 8's new features.

Editor's review

很多讲 Java 8 的书只是把新语法罗列一遍,而这本书的不同在于:它从「为什么要这样设计」出发。第 2 章先用筛选苹果的例子把行为参数化讲透,Lambda 的语法就变得顺理成章,而不是死记硬背的符号。Stream 部分同样如此,从引入、使用到收集,一路把惰性求值、短路、并行切分的来龙去脉交代清楚。 作者之一的 Mario Fusco 是 Red Hat 的工程师,也是 lambdaj 库的作者;另两位作者来自剑桥大学,学术与工程经验兼备。译文由长期从事底层研发的陆明刚与劳佳合作完成,术语统一,读起来不拗口。全书每章结尾都有小结和随堂小测,适合当作「边学边练」的教材使用;附录还延伸到字节码与 InvokeDynamic,给了想深挖原理的读者一条向上攀爬的路径。 对于仍在维护 Java 8 项目、或想补上函数式思维这一课的开发者,这本书是把旧代码改写成简洁现代写法的实用手册。豆瓣 9.1 分的高评价,也说明它经受住了时间检验。

Who it's for

A good fit for

  • 已掌握 Java 语法、想系统学习 Lambda 与 Stream 的初中级开发者
  • 维护 Java 8 项目、需要重构旧代码的工程人员
  • 准备技术面试、需覆盖 Java 8 新特性的求职者
  • 对函数式编程感兴趣、希望从 Java 角度入门的程序员

Not a good fit for

  • 完全没有 Java 基础、尚未学过面向对象的零基础读者
  • 只想找框架速查手册、不打算系统阅读的人
  • 只使用 Java 11 及以上版本、想专攻新特性的读者(可读续作)

Reading tips

  1. 先按顺序读第 1—3 章,把行为参数化到 Lambda 的思路走通,后面会顺畅很多。
  2. 第 4—6 章的示例建议亲手敲一遍,边改写集合操作边体会流的惰性与短路。
  3. 第 3 部分可按项目需要跳读,例如先攻 Optional 与日期时间 API,再回头补 CompletableFuture。
  4. 读完一章先做章末小测,再对照书末附录理解字节码层面的实现原理。

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 Java 8 Matters
  3. Chapter 2 Passing Code Through Behavior Parameterization
  4. Chapter 3 Lambda Expressions
  5. Part 2 Functional-Style Data Processing
  6. Chapter 4 Introducing Streams
  7. Chapter 5 Working with Streams
  8. Chapter 6 Collecting Data with Streams
  9. Chapter 7 Parallel Data Processing and Performance
  10. Part 3 Efficient Java 8 Programming
  11. Chapter 8 Refactoring, Testing, and Debugging
  12. Chapter 9 Default Methods
  13. Chapter 10 Replacing null with Optional
  14. Chapter 11 CompletableFuture: Composable Asynchronous Programming
  15. Chapter 12 The New Date and Time API
  16. Part 4 Beyond Java 8
  17. Chapter 13 Functional Thinking
  18. Chapter 14 Techniques of Functional Programming
  19. Chapter 15 Blending Object-Oriented and Functional Programming: Java 8 vs. Scala
  20. Chapter 16 Conclusion and the Future of Java
  21. Appendix A Updates to Other Language Features
  22. Appendix B Updates to the Class Libraries
  23. Appendix C Performing Multiple Operations Concurrently on the Same Stream
  24. Appendix D Lambda Expressions and JVM Bytecode

FAQ

这本书和《Modern Java in Action》是什么关系?
《Java 8实战》的原书是《Java 8 in Action》。作者团队后来将其扩展升级为《Modern Java in Action》(第 2 版),覆盖到 Java 9 及之后的新特性。若主要用 Java 8,中文版《Java 8实战》已足够。
没有 Java 基础,能直接读这本书吗?
不太建议。书中示例默认读者熟悉类、接口、泛型和集合,一上来就讲行为参数化会显得吃力。建议先掌握 Java 语法基础,再来读这本。
书里的代码可以直接运行吗?
可以。示例基于 Java 8 的 JDK 编写,多数代码可直接编译运行;部分示例涉及书中自定义的辅助类,需配合作者提供的示例代码仓库使用。
这本书适合当作面试复习资料吗?
适合作为系统性复习材料。Lambda、Stream、Optional、默认方法的用法与原理都是常见考点,且书中附录对字节码实现有介绍,能应付追问。

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.

Top rated in the same category