Code example for Multiset

Methods: count

0
        counts.addAll(events);
        total = counts.elementSet().size();
    } 
 
    public int count(T event) {
        return counts.count(event);
    } 
 
    @Override 
    public float prob(T event) {
        if (total == 0) {
            return epsilon(); 
        } 
        return ((float)counts.count(event)) / total;
    } 
 
    @Override 
    public Set<T> events() {
        return counts.elementSet();
    }