Use standard Collections

In the Collections Framework, there are many implementation classes to choose from. Most of the time, one of these "primary implementations&qu...

2014-02-23 23:55:08

阅读数 417

评论数 0

Use interface references to Collections In general, references to objects should be as generic as possible. The user of such a r...

2014-02-23 23:49:50

阅读数 485

评论数 0

Use for-each liberally The for-each loop is used with both collections and arrays. It's intended to simplify...

2014-02-23 23:47:47

阅读数 443

评论数 0

Two ways of using Iterator When the for-each loop is not available, and an explicit Iterator is needed, then itera...

2014-02-23 23:41:28

阅读数 418

评论数 0

Prefer Collections over older classes Most programmers prefer the Java Collections Framework to arrays, Vector, and Hashtable,...

2014-02-23 23:36:08

阅读数 493

评论数 0

Iterate without an index Many programmers have a strong preference for using a for-each loop or an Iterator instead...

2014-02-23 23:31:26

阅读数 435

评论数 0

Encapsulate collections In general, Collections are not immutable objects. As such, one must often exercise care ...

2014-02-23 23:28:29

阅读数 466

评论数 0

Choosing the right Collection Here's a guide for selecting the proper implementation of a Set, List, or Map. It was co...

2014-02-23 23:18:24

阅读数 433

评论数 0

Reading and writing text files In JDK 7, the most important classes for text files are: Paths and Path - file loca...

2014-02-23 23:03:52

阅读数 524

评论数 0

Reading and writing Serializable objects Reading and writing Serializable objects is very similar to reading and writing text: i...

2014-02-23 23:00:06

阅读数 501

评论数 0

Reading and writing binary files In JDK 7, the most important classes for binary files are: Paths and Path - file locat...

2014-02-23 22:50:17

阅读数 466

评论数 0

Copy a file In JDK 7+, copying a file is a simple operation, involving a single call to File.copy. ...

2014-02-23 22:46:50

阅读数 460

评论数 0

取消 删除