I have to store String values in a HashMap. The key and values will be only numerals in String representation. If I change them to Integer and use Map<Integer,Integer> instead of Map<String,String>, will it increase the performance a bit?
I wouldn't expect it to make any significant difference. If they will always be integers though - and especially if they're going to be used as numbers at a later point - I'd probably convert them just to better represent what the data is. (It also means you'll catch errors - where the string isn't a number - earlier).
Personally i feel it would increase performance (a little)
Strings have an overhead of using the string pool. So when you create a key, a lot ot stuff happens.
Integers on the other hand are easier to create and destroy. Furthermore, Strings are backed by an array of characters. So a key like
11221 will be 10 byte while the same as an int would be 4 byte.