public Map sort(Class type, Map keyedByFieldKey) {
Map map = new TreeMap(new Comparator() {
public int compare(Object o1, Object o2) {
final FieldKey fieldKey1 = (FieldKey)o1;
final FieldKey fieldKey2 = (FieldKey)o2;
return fieldKey1.getFieldName().compareTo(fieldKey2.getFieldName());
}
});
map.putAll(keyedByFieldKey);
return map;
}