public Map<String, Integer> word0(String[] strings) {
int len=strings.length;
Map<String, Integer> map = new HashMap<String, Integer>();
for(int i=0;i<len;i++){
map.put(strings[i],0);
}
return map;
}
(But I guess compiler optimalisation will do that for you)
I don't know.
Without that variable, for each iteration of the loop you'll evaluate
strings.length
If you store that value in a variable, you only determine the length once.
(But I guess compiler optimalisation will do that for you)