When debugging, why does the HashMap differ in Katalon vs Eclipse

I created the following HashMap. When I debug the code and look inside the
HashMap, in Katalon it shows three values listed below and many null values. If I run the same code in Eclipse, I only see three values like it should?

HashMap<String, String> hashResponse = new HashMap<String, String>();

hashResponse.put(“2”, “Apple”)
hashResponse.put(“1”, “Grapes”)
hashResponse.put(“3”, “Orange”)

System.out.println(hashResponse)

Eclipse
Eclipse

Katalon

I believe that the internal of “HashMap” class of JDKs is the same in Katalon and in Eclipse.

I think, the difference is in the design of debugger software in Katalon and in Eclipse.


Why Katalon showed null entries at [4] - [15]?

Read the javadoc of HashMap carefully.

HashMap()
Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).

The expression “new HashMap()” creates an instance with the default capacity of 16. And you put only 3 entries. So the instance has 16 - 3 = 13 entries which are not used yet.

Katalon’s debugger is showing the internal of the HashMap instance as is. Therefore you found 13 "null"s displayed. Nothing mysterious.

Why Eclipse’s debugger does not show the null entries?

I suppose, Eclipse’s debugger is designed as such. The GUI is designed to ignore the unused entries which would inform you nothing important. I think it is a reasonable design. Nothing harmful.

The difference in the design of 2 debuggers is not an issue, I think.

Agreed, it’s not an issue.
At same time, it’s so much easier to read the HashMap in Eclipse while debugging than it is to understand in Katalon during debugging.

Thanks