A Concise Tutorial on Java 8 cover

A Concise Tutorial on Java 8

No rating yet
Chapters
21

Tags

Summary

A Concise Tutorial on Java 8 originates from Benjamin Winterberg's long English article Modern Java - A Guide to Java 8 (published in March 2014); the Chinese version was translated by Huang Xiaofei of the ImportNew community and later circulated widely online as an electronic document and across multiple platforms. The book does not aim to be comprehensive; instead, through code examples plus brief explanations, it demonstrates item by item the language and API changes brought by Java 8: adding default implementations to interfaces with the default keyword, lambda expressions and functional interfaces, method and constructor references, repeatable annotations, and more; the latter half turns to new APIs, covering intermediate and terminal operations of Stream, the functional interface system, the extended methods of Map, and the entirely new java.time date-time API. The author states his position at the outset: Java has not declined, and Java 8 gives the language functional-style expressive power. There is almost no lengthy theory; most of the text is a short runnable code snippet with one or a few comments, so readers can type along, modify, and see the results. Because the book is small and its updates depend on the author's blog and community translations, it is more a quick overview of new features readable in one or two evenings, suited to developers who already write Java 6/7 and want to migrate old code to Java 8 style as soon as possible, not to complete beginners as a first Java textbook.

Editor's review

市面上的 Java 8 书大多有两类毛病:一类厚得像砖,把语法、JVM、并发全塞进去,读者翻到 Lambda 章节时力气已用完;另一类短得像备忘录,只列特性不讲缘由。这份教程恰好落在中间——三四十页的篇幅,二十来个主题,每个主题先给「旧写法」再给「新写法」,对照之下 Lambda 与方法引用到底省了什么,一眼可见。它最大的价值不是权威,而是轻快:地铁上、午休时翻完,就能把项目里那堆匿名内部类改成箭头函数。需要提醒的是,它是网络译文而非正式出版物,示例与 API 细节以 Java 8 早期版本为准,个别表述与后来的修正译文略有出入,遇到疑惑仍应回到 JDK 官方文档核对。适合当作「Java 8 迁移的第一根拐杖」,不适合当作查缺补漏的案头手册。

Who it's for

A good fit for

  • 已掌握 Java 基本语法、想快速补齐 Java 8 新特性的在职开发者
  • 需要把旧代码改写为 Lambda / Stream 风格的维护人员
  • 把 Java 8 当作面试考点的应届生与转行者
  • 喜欢以短小代码片段对照学习、不爱读长篇理论的读者

Not a good fit for

  • 完全没写过 Java、连类与接口都不熟悉的零基础读者
  • 希望系统深入 JVM、并发原理与性能调优的中高级工程师
  • 需要严格依据正式出版物引用页码与 ISBN 的论文写作者

Reading tips

  1. 建议边读边在 IDE 中敲示例,每节改一个新写法再运行,比只读效果好得多。
  2. 阅读顺序可按「默认方法 → Lambda → 函数式接口 → 方法引用 → Stream → 日期时间」推进,前后依赖较清晰。
  3. 遇到文中 API 细节存疑时,以 Oracle 官方 Java Tutorial 为准,译文仅作入门引导。
  4. 读完后挑一个旧项目里最啰嗦的 for 循环或匿名类,实际重写一遍,把知识落成肌肉记忆。

Contents

  1. Default Methods in Interfaces
  2. Lambda Expressions
  3. Functional Interfaces
  4. Method and Constructor References
  5. Lambda Expression Scope
  6. Accessing Local Variables
  7. Accessing Fields and Static Variables
  8. Using Default Methods in Interfaces
  9. Built-in Functional Interfaces
  10. Person and Comparator Example
  11. Stream
  12. Filter
  13. Sorted
  14. Map
  15. Match
  16. Count
  17. Reduce
  18. Parallel Streams
  19. Extended Methods of Map
  20. The New Date-Time API
  21. Annotations (Repeatable Annotations)

FAQ

这本书是正式出版的纸质书吗?
不是。它源自 Benjamin Winterberg 的英文长文《Modern Java - A Guide to Java 8》,中文版由 ImportNew 社区译者黄小非翻译,主要以网络电子文档与博客连载形式流传,因此没有可核实的出版社、ISBN 与定价信息。
零基础能直接读它学 Java 吗?
不建议。书中默认读者已会写类、接口、集合与匿名内部类,几乎不讲解基础语法,上来就是默认方法与 Lambda。零基础读者应先完成一本系统入门教材,再回来看它。
内容会不会已经过时?
作为「Java 8 新特性速览」并不过时,它讲的默认方法、Lambda、Stream、java.time 至今仍是日常写法;但 Java 9 之后新增的模块系统、var、记录类、switch 模式匹配等均未涉及,需另找资料。
书中的代码示例能直接运行吗?
多数片段可运行,但需注意原文基于 Java 8 早期版本,个别示例可能需要补全 import、类名或泛型声明。建议在 JDK 8 及以上环境中按需补全后运行。
和 Oracle 官方的 Java Tutorial 是什么关系?
两者没有直接血缘关系。本书是个人博客性质的快速指南,Oracle 官方教程则是系统全面的平台文档,可作为本书的补充与核对来源。

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