Unfortunately, it is if we want to make things "easy." HashMap is based on hashCode() and equals(); for string-based keys, this will not cooperate with instances of Utf8 that are used as keys here. TreeMap lets us provide a custom comparator that can work with either strings or Utf8 when searching for a key.