As the assertion is about sorting, maybe the hashCode and equals methods of the LocalizedId are of interest. I would suggest having a closer look at them.