HashMap

Hash table based map

Interview Relevant: Very important - internal working

HashMap

Unordered, allows one null key.

Code Examples

HashMap example

java
1
2Map<String, String> map = new HashMap<>();
3map.put(null, "value");
4          

Use Cases

  • Fast access

Common Mistakes to Avoid

  • Ignoring thread safety