Map propertiesToRule = new HashMap();
Iterator rules = styleSheet.getRules().iterator();
while (rules.hasNext()) {
Rule rule = (Rule) rules.next();
StyleProperties properties = rule.getProperties();
// If the theme already has a rule with this properties ...
Rule existingRule = (Rule) propertiesToRule.get(properties);
if (existingRule != null) {
// ... then we should add this rule's selectors to the existing
// rule with those properties and throw this rule away.