java - TreeMap and LinkedHashMap classes -


i found java question j couldn't understand should answer

the treemap , linkedhashmap classes:

  1. enable iteration of map's entries based on insertion order of elements only.
  2. enable iteration of map's entries based on natural ordering of keys only.
  3. enable iteration of map's entries in deterministic order.
  4. enable iteration of map's entries based either natural ordering of keys or natural ordering of values depending on arguments sent contructor.

in java:

  1. treemap map automatically sorts map entries according natural ordering using comparable<t> interface
  2. linkedhashmap map guarantees entries returned in same order added

Comments