List is an ordered Collection and also allowes duplicates.
Map is based on hashing and stores key and value in an Object called entry. It provides O(1) performance to get object, if you know keys, if there is no collision.
Another key difference between Set, List and Map are that Map doesn't implement Collection interface, while other two does.
Popular impelmentation of Set is HashSet, of List is ArrayList and LinkedList, and of Map are HashMap, Hashtable and ConcurrentHashMap.
-------------------------------------------------------------------
- Set : 중복이 불가해서 고유성은 보장되지만, 순서 유지 불가능- List : 순서가 유지되고, 중복 가능
- Map : key와 value로 entry라 불리는 Object를 저장하고 찾는다. 키를 알고 있고, 충돌이 없다면, object를 얻는데 performance가 가장 좋다
- 구현체 중 많이 쓰이는것
> Set : HashSet
> List : ArrayList, LinkedList
> Map : HashMap, Hashtable, ConcurrentHashMap.
출처 :
http://javarevisited.blogspot.kr/2011/11/collection-interview-questions-answers.html
댓글 없음:
댓글 쓰기