Learn to create immutable collections such as immutable list, immutable set and immutable map using new factory methods in Java 9.
This is no doubt, most asked beginner level java interview question. And sometimes you can face at medium level interviews also. So, my suggestion is to learn it here and for ever. Lets start with immutability itself. An immutable object is an object which state is guaranteed to stay identical over its entire lifetime. This […]
Can we use an object as a key for a hashmap in java? This is a very popular interview question indeed. It is asked immediately after “How HashMap works?”. Lets make a reasoning around user defined object as key in hashmap in java. 1. The contract between hashCode() and equals() The very basic need for […]