Is there anything that hashmap can do, but a map cannot?

I only know that the difference between hashmap and map is that hashmap is implemented using a hash function, but a map is implemented using a tree. Can any body add anything else?

Based on this, is there anything that hashmap can do, but the map cannot?

+5
source share
3 answers
  • Hashmaps have average performance, higher performance for access (O (1)), but worse worst case performance (O (n)). Cards are always equal to O (log (n)).

  • Maps are ordered by their key, hashmaps are not.

  • Hashmaps , .

  • .

  • - , ( ).

, - .

+10

, , , , . - -. , hashmap , .

+3

, hashmaps , , , - - ( ) .

Almost because there can be metadata for updating (the number of elements in the hash table, for example). And you probably will need to lock the entire table in order to grow or shrink it, of course.

0
source

All Articles