Skip to content

Collections

🗂️ Collections (HashMap)

Have you worked on HashMap?

What is the internal mechanism of HashMap?

What happens when a collision occurs in HashMap?

Why was Red-Black Tree introduced in Java 8 HashMap?

What is the time complexity of Red-Black Tree?

What is the time complexity of Linked List?

If there is no improvement, why switch to Red-Black Tree?

What happens if two keys have the same hash code?

Do we check equals() method in that case?

What happens when hashCode is same but objects are different?