62. You add an element already exist in SET. How did JVM do that? Equal () method and HashCode() method, which one call first.
You add an element already exist in SET. How did JVM do that? Equal () method and HashCode() method, which one call first?
When you add an element into SET, first, it will hashCode () the value and hashCode () value is the bucket identifier.
If there is no bucket exist with the same hashCode, it will create new one and store elements
Otherwise, it will check the elements in that bucket to see if any element already has the same key by using the equals method.
if no one exist, it will create a new one otherwise, it will ignore that element