#List
Class Name | Add | Remove | Get | Contains |
---|
ArrayList | O(1) | O(n) | O(1) | O(n) |
LinkedList | O(1) | O(1) | O(n) | O(n) |
#Set
Class Name | Add | Contains | Next |
---|
HashSet | O(1) | O(1) | O(h/n) |
LinkedHashSet | O(1) | O(1) | O(1) |
EnumSet | O(1) | O(1) | O(1) |
TreeSet | O(log n) | O(log n) | O(log n) |
#Queue
Class Name | Offer | Peak | Poll | Size |
---|
PriorityQueue | O(log n) | O(1) | O(log n) | O(1) |
LinkedList | O(1) | O(1) | O(1) | O(1) |
ArrayDequeue | O(1) | O(1) | O(1) | O(1) |
DelayQueue | O(log n) | O(1) | O(log n) | O(1) |
#Map
Class Name | Get | ContainsKey | Next |
---|
HashMap | O(1) | O(1) | O(h/n) |
LinkedHashMap | O(1) | O(1) | O(1) |
WeakHashMap | O(1) | O(1) | O(h/n) |
EnumMap | O(1) | O(1) | O(1) |
TreeMap | O(log n) | O(log n) | O(log n)
|
* 참고
http://kwseo.github.io/2015/09/24/time-complexity-about-collections/