7

Today I learned the difference between Hashmap and LinkedHashMap in Java.
After 20 years of PHP development I could not undestand the difference until I hit my nose on an error.
It'hard to change yous development stack whene you are 50 year old.

Comments
  • 4
    So I did look it up as well, and there was my biggest enemy, the O(1) notation. That fucker. I don't trust him.
  • 1
    @retoor constant time is a lie. relativeteey!
  • 0
    Without looking it up, here's my interpretation:

    HashMap is just a regular hash map with an array on one side storing hashes, and a value on the other side (depending on implementation, this is typically a list due to collisions in hash maps)

    HashMap = HashMapEntry[ {bin hash, HashMapValue[ ]} ]

    LinkedHashMap sounds like the same thing, but linked list driven?

    LinkedHashMap = Root = {bin hash, HashMapValue[], Node next}
Add Comment