Immutability is a feature that means unchangeable or unmodified.
In Java, the concept of the Immutable class says once an object is created we can not change its content. In the process of creating an immutable class final keyword plays an important role.
All the wrapper and String classes are immutable.
Rules for creating an immutable class
A singleton is a design pattern that allows the only single instance to be created in the memory.
In Java, a singleton design pattern lets us create only one instance of a class throughout the application and it ensures that a single instance present in memory(JVM).
Some rules are must be applied when we create a singleton class.
In this article, we will see internal working and implementation of HashMap. And also we will learn how to fetch elements using the get() method, what happens when we call the put() method for storing elements, and what is the purpose of hashing.
Before we dive into HashMap’s internal working there are a few concepts that should be cleared.
Hashing — Hashing is a process of converting an object into an integer form by using the hashCode() method. Hash code represents the memory reference of the object.
Syntax — public int hashCode()
equals() — This method is…