Suppose we have a HashMap:
Map<Integer, Integer> stash = new HashMap<>();
elements of type int are put in the stash for both the key and value. Now, let's say we need to work with these values: divide some int into them. Those. so be it :
int amount; ... for (Map.Entry stashEnrty : stash.enrtySet()) { amount = amount / (int) stashEntry.getKey(); }
Suppose there are many such places in the code, and it is necessary to cast int to many times. Are there ways to avoid this? The key and value are added values that are spars from String through Integer.parseInt ()
(int)
? .-. Autounboxing not working? - D-side