Reference Address: http://blog.csdn.net/speedme/article/details/22398395
A few words like, copy down:
- There was no collection on Earth (only the array reference C language) but someone wanted it, so there was a collection
- Some people want an array that can be automatically expanded, so there's a list
- Some people want to have no duplicate arrays, so there's set
- Some people want to have automatic sorting of the number of groups, so with treeset,treelist,tree**
Same point:
1.list,set,map holds objects as object types.
2.Collection, List, Set, map are interfaces and cannot be instantiated.
Different points:
1.map is a key-value pair, andkey is always unique, and value allows repetition.
2. the number of elements stored in each location is different, collection type, each location has only one element. Map is a key-value pair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
owning relationship:
Collection
--list: Elements are stored in a specific order. So the order taken out may be different from the order in which it is put.
--arraylist/linkedlist/vector
--set: cannot contain duplicate elements
--hashset/treeset
Map
--hashmap
--hashtable
--treemap
Java Interview Basics------"list, Set, map similarities and differences in Java