title: Which is faster in accessing elements from Java collections
body: <p>I am trying to understand which is faster in accessing elements from collections in Java like ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap etc.</p>
  
  <p>From this question: <a href="https://stackoverflow.com/questions/19201944/suitable-java-collection-for-fast-get-and-fast-removal">Suitable java collection for fast get and fast removal</a>, I got to know that ArrayList takes O(1) and TreeMap as O(log n)</p>
  
  <p>where as this: <a href="https://stackoverflow.com/questions/8451526/map-arraylist-which-one-is-faster-to-search-for-an-element">Map/ArrayList: which one is faster to search for an element</a> shows that ArryList is O(n), HashMap as O(1) and TreeMap as O(log n)</p>
  
  <p>where as this: <a href="https://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array?rq=1">Why is it faster to process a sorted array than an unsorted array?</a> says that sorted array is faster than unsorted array. As the elements in TreeMap are sorted then can I assume all sorted collections are faster than un-sorted collections?</p>
  
  <p>Please help me in understanding which is faster to use in accessing elements from java collections of list, set, map etc implementations.</p>