CategoryAssociationsContainer categoryAssociations = (CategoryAssociationsContainer) categories;
HashMap<CategoryListParams,Iterable<CategoryPath>> categoryLists =
new HashMap<CategoryListParams,Iterable<CategoryPath>>();
for (CategoryPath cp : categories) {
// each category may be indexed under a different field, so add it to the right list.
CategoryListParams clp = indexingParams.getCategoryListParams(cp);
CategoryAssociationsContainer clpContainer = (CategoryAssociationsContainer) categoryLists.get(clp);
if (clpContainer == null) {
clpContainer = new CategoryAssociationsContainer();
categoryLists.put(clp, clpContainer);
}