Why is my HashMap not updating values inside a loop? #163973
Replies: 1 comment
-
Hey! Good question — you're super close, but there's just one small issue in your logic. In your loop, you're getting the current count from the map, and if it's null, you set it to 0 — which is good. But then you're just putting that same value (0) back into the map without incrementing it.Hey! Good question — you're super close, but there's just one small issue in your logic. |
BetaWas this translation helpful?Give feedback.
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hi everyone,
I'm working on a Java program that processes a list of items and stores some results in a HashMap. However, the values in the map don't seem to update as expected when I loop through the list.
BetaWas this translation helpful?Give feedback.
All reactions