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

  1. Make class as final — so the inheritance will not be possible and child class cannot be created for changing the property of parent/actual class.
  2. Make variables final — because of this any kind of changes can not happen to the variables, all…

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.

  1. A public static method to get the instance of the class from anywhere in the application.
  2. Private constructor to instantiate the object of the class.
  3. It must have a private static variable of the same class which is the only reference of…


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.

  1. Hashing
  2. Bucket
  3. Node

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…

Arpit Bhatt

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store