difference between treemap and hashmap code example
Example 1: difference between treeset and treemap
TreeSet: Can contain only unique values and
it is sorted in ascending order
TreeMap: Can contain only unique keys and
keys are sorted in ascending order.
Example 2: treemap vs hashmap
- TreeMap doesn't have null key and keys are sorted
Can contain only unique keys and keys are sorted in ascending order.
v- HasHMap can have null key, order is not guaranteed