If you change the serialization of the Map as suggested, we wont need this new Comparator class at all. We can use Bytes.ByteArrayComparator directly