图书 | Effective Java(第3版英文版)/原味精品书系 |
内容 | 内容推荐 自从Java 6发布之后,Java又有了翻天覆地的变化。本书涵盖了Java 7、Java 8和Java 9中语言和库的各种新特性。让你能够深入了解Java平台的细微之处。通过对每一个项目的全面描述和解释,告诉你应该做什么、不应该做什么,以及为什么要这样做。 作者简介 约书亚·布洛克是卡耐基梅隆大学的教授。他曾经是Google公司的首席Java架构师、Sun公司的杰出工程师以及Transarc公司的不错系统设计师。Bloch曾带领团队设计并实现过无数的Java平台特性;包括JDK5.0语言增强版,并且Java集合框架上屡获殊荣。他拥有卡耐基梅隆大学的计算机科学博士学位以及哥伦比亚大学的计算机科学学士学位。 目录 1 Introduction1 2 Creating and Destroying Objects5 Item 1: Consider static factory methods instead of constructors5 Item 2: Consider a builder when faced with many constructor parameters10 Item 3: Enforce the singleton property with a private constructor or an enum type17 Item 4: Enforce noninstantiability with a private constructor19 Item 5: Prefer dependency injection to hardwiring resources20 Item 6: Avoid creating unnecessary objects22 Item 7: Eliminate obsolete object references26 Item 8: Avoid finalizers and cleaners 29 Item 9: Prefer try-with-resources to try-finally34 3 Methods Common to All Objects37 Item 10: Obey the general contract when overriding equals37 Item 11: Always override hashCode when you override equals50 Item 12: Always override toString55 Item 13: Override clone judiciously58 Item 14: Consider implementing Comparable66 4 Classes and Interfaces73 Item 15: Minimize the accessibility of classes and members73 Item 16: In public classes, use accessor methods, not public fields78 Item 17: Minimize mutability80 Item 18: Favor composition over inheritance87 Item 19: Design and document for inheritance or else prohibit it 93 Item 20: Prefer interfaces to abstract classes99 Item 21: Design interfaces for posterity104 Item 22: Use interfaces only to define types107 Item 23: Prefer class hierarchies to tagged classes109 Item 24: Favor static member classes over nonstatic112 Item 25: Limit source files to a single top-level class115 5 Generics117 Item 26: Don’t use raw types117 Item 27: Eliminate unchecked warnings123 Item 28: Prefer lists to arrays126 Item 29: Favor generic types130 Item 30: Favor generic methods135 Item 31: Use bounded wildcards to increase API flexibility139 Item 32: Combine generics and varargs judiciously146 Item 33: Consider typesafe heterogeneous containers151 6 Enums and Annotations157 Item 34: Use enums instead of int constants157 Item 35: Use instance fields instead of ordinals168 Item 36: Use EnumSet instead of bit fields 169 Item 37: Use EnumMap instead of ordinal indexing171 Item 38: Emulate extensible enums with interfaces176 Item 39: Prefer annotations to naming patterns180 Item 40: Consistently use the Override annotation188 Item 41: Use marker interfaces to define types191 7 Lambdas and Streams193 Item 42: Prefer lambdas to anonymous classes193 Item 43: Prefer method references to lambdas197 Item 44: Favor the use of standard functional interfaces199 Item 45: Use streams judiciously203 Item 46: Prefer side-effect-free functions in streams210 Item 47: Prefer Collection to Stream as a return type216 Item 48: Use caution when making streams parallel222 8 Methods227 Item 49: Check parameters for validity227 Item 50: Make defensive copies when needed231 Item 51: Design method signatures carefully236 Item 52: Use overloading judiciously 238 Item 53: Use varargs judiciously245 Item 54: Return empty collections or arrays, not nulls247 Item 55: Return optionals judiciously249 Item 56: Write doc comments for all exposed API elements254 9 General Programming261 Item 57: Minimize the scope of local variables261 Item 58: Prefer for-each loops to traditional for loops264 Item 59: Know and use the libraries267 Item 60: Avoid float and double if exact answers are required270 Item 61: Prefer primitive types to boxed primitives273 Item 62: Avoid strings where other types are more appropriate276 Item 63: Beware the performance of string concatenation 279 Item 64: Refer to objects by their interfaces280 Item 65: Prefer interfaces to reflection282 Item 66: Use native methods judiciously285 Item 67: Optimize judiciously286 Item 68: Adhere to generally accepted naming conventions289 10 Exceptions293 Item 69: Use exceptions only for exceptional conditions293 Item 70: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors296 Item 71: Avoid unnecessary use of checked exceptions298 Item 72: Favor the use of standard exceptions 300 Item 73: Throw exceptions appropriate to the abstraction302 Item 74: Document all exceptions thrown by each method304 Item 75: Include failure-capture information in detail messages306 Item 76: Strive for failure atomicity308 Item 77: Don’t ignore exceptions 310 11 Concurrency311 Item 78: Synchronize access to shared mutable data311 Item 79: Avoid excessive synchronization 317 Item 80: Prefer executors, tasks, and streams to threads323 Item 81: Prefer concurrency utilities to wait and notify325 Item 82: Document thread safety330 Item 83: Use lazy initialization judiciously333 Item 84: Don’t depend on the thread scheduler336 12 Serialization339 Item 85: Prefer alternatives to Java serialization339 Item 86: Implement Serializable with great caution343 Item 87: Consider using a custom serialized form346 Item 88: Write readObject methods defensively353 Item 89: For instance control, prefer enum types to readResolve 359 Item 90: Consider serialization proxies instead of serialized instances363 Items Corresponding to Second Edition367 References371 Index377 |
标签 | |
缩略图 | ![]() |
书名 | Effective Java(第3版英文版)/原味精品书系 |
副书名 | |
原作名 | |
作者 | (美)约书亚·布洛克 |
译者 | |
编者 | |
绘者 | |
出版社 | 电子工业出版社 |
商品编码(ISBN) | 9787121342608 |
开本 | 16开 |
页数 | 392 |
版次 | 1 |
装订 | 平装 |
字数 | 507 |
出版时间 | 2018-07 |
首版时间 | 2018-07 |
印刷时间 | 2018-07 |
正文语种 | 英 |
读者对象 | 普通大众 |
适用范围 | |
发行范围 | 公开发行 |
发行模式 | 实体书 |
首发网站 | |
连载网址 | |
图书大类 | |
图书小类 | |
重量 | 636 |
CIP核字 | 2018109375 |
中图分类号 | TP312.8 |
丛书名 | |
印张 | 25.25 |
印次 | 1 |
出版地 | 北京 |
长 | 234 |
宽 | 184 |
高 | 17 |
整理 | |
媒质 | 图书 |
用纸 | 普通纸 |
是否注音 | 否 |
影印版本 | 原版 |
出版商国别 | CN |
是否套装 | |
著作权合同登记号 | 图字01-2018-2402 |
版权提供者 | 由Pearson Education Inc. 授权出版 |
定价 | 99.00 |
印数 | |
出品方 | |
作品荣誉 | |
主角 | |
配角 | |
其他角色 | |
一句话简介 | |
立意 | |
作品视角 | |
所属系列 | |
文章进度 | |
内容简介 | |
作者简介 | |
目录 | |
文摘 | |
安全警示 | 适度休息有益身心健康,请勿长期沉迷于阅读小说。 |
随便看 |
|
兰台网图书档案馆全面收录古今中外各种图书,详细介绍图书的基本信息及目录、摘要等图书资料。