public SetMultimap<AttributegroupEntity, AttributeEntity> findAttributesByStatus() {
SortedSetMultimap<AttributegroupEntity, AttributeEntity> set = Multimaps.newSortedSetMultimap(
new HashMap<AttributegroupEntity, Collection<AttributeEntity>>(),
new Supplier<TreeSet<AttributeEntity>>() {
@Override
public TreeSet<AttributeEntity> get() {
return new TreeSet<>(new Comparator<AttributeEntity>() {
@Override
public int compare(AttributeEntity o1, AttributeEntity o2) {
return o1.getName().compareTo(o2.getName());
}
});
}
});
//SetMultimap<AttributegroupEntity, AttributeEntity> set = HashMultimap.create();
List<ProductEntity> products = this.findByStatus();
for (ProductEntity product : products) {
set.putAll(product.getAttributegroupAsMultiMap());
}
return set;
}