Java collection summary
来源:互联网 发布:原生js实现下拉刷新 编辑:程序博客网 时间:2024/05/16 11:30
- An array associates numerical indices to objects. It holds objects of a known type so that you don’t have to cast the result when you’re looking up an object. It can be multidimensional, and it can hold primitives. However, its size cannot be changed once you create it.
- A Collection holds single elements, and a Map holds associated pairs.
- Like an array, a List also associates numerical indices to objects—you can think of arrays and Lists as ordered containers. The List automatically resizes itself as you add more elements. But a List can hold only Object references, so it won’t hold primitives, and you must always cast the result when you pull an Object reference out of a container.
- Use an ArrayList if you’re doing a lot of random accesses, but a LinkedList if you will be doing a lot of insertions and removals in the middle of the list.
- The behavior of queues, deques, and stacks is provided via the LinkedList.
- A Map is a way to associate not numbers, but objects with other objects. The design of a HashMap is focused on rapid access, whereas a TreeMap keeps its keys in sorted order, and thus is not as fast as a HashMap. A LinkedHashMap keeps its elements in insertion order, but may also reorder them with its LRU algorithm.
- A Set only accepts one of each type of object. HashSets provide maximally fast lookups, whereas TreeSets keep the elements in sorted order. LinkedHashSets keep elements in insertion order.
- There’s no need to use the legacy classes Vector, Hashtable, and Stack in new code.
From <Thinking in Java, 3rd ed. Revision 4.0>
- Java collection summary
- Java Collection Summary
- TWU Summary - collection
- Java Summary
- 【java】【java Collection】Collection
- Java: Keywords Combination Summary
- java useful commands summary
- Java Algorithm Learning Summary
- Effective Java -- summary
- Java Array Summary
- { Java Puzzlers } Summary
- (java)Summary Ranges
- some java summary
- The summary of Java
- <Summary> Java book list
- java inerview summary
- java Collection
- java collection
- 学习工作中的一个PHP文件下载代码
- visual C++ 6.0开发工具与调试
- IEWebControls的安装
- 本地化测试软件缺陷分类详解
- abap--关于异常的处理
- Java collection summary
- 怎么制作没有工具栏,地址栏...的网页
- 刚学C写的东西,纪念下:)
- OpenMP与C++:事半功倍地获得多线程的好处(上)
- 浅谈软件分层
- 可恶的Folli Follie
- 04/03/2007
- 改变一生的五句话
- OpenMP与C++:事半功倍地获得多线程的好处(下)