update java Anagram's example based on feedback