Last Updated: February 25, 2016
· orhanobut
62009 433414993266 4621115 n

HashMap, LinkedHashMap, TreeMap, WeakHashMap


  • Implements Map interface
  • No order guaranteed, order can be changed even when a new element added
  • get, put, remove, contains complexity is O(1)
  • null key and values are allowed
  • Implementation is buckets


  • Same as HashMap but the difference is it keeps elements in insert order.
  • Implementation is doubly linked list
  • put,remove complexity is O(1)

<li>Keys of the map stored in weakreference. By doing this, key-value pairs can be dropped in dynamically when the only reference is from weakreference. </li>
<li>When the system needs more resource, those entries will be dropped</li>


  • Implements Map, SortedMap and NavigableMap
  • Sorted based on keys
  • get,put,remove, contains complexity is O(log(n))
  • only values can be null
  • Implementation is red-black tree
Say Thanks