Here are few things I learnt while coding in java: Increment an occurrence in map for(char current : input.toCharArray()){ count.put(current, count.getOrDefault(current, 0) + 1); } Let’s say you want to decrement the occurrence and when occurrence becomes zero, remove entry.Continue reading… Core Java: Programming code snippets frequently used