Code example for Multiset

Methods: add

0
  public RulesAggregation() { 
    this.rules = HashMultiset.create();
  } 
 
  public RulesAggregation add(RuleDto ruleDto) {
    rules.add(new Rule(ruleDto.getKey(), ruleDto.getName()));
    return this;
  } 
 
  public Collection<Rule> rules() {
    return rules.elementSet();
  } 
 
  public int countRule(Rule rule) {
    return rules.count(rule);
  } 
 
  public static class Rule { 
 
    private RuleKey ruleKey;