public class Liste<T> {
    private Association<T> a;

    public Liste() {
    }

    public void setFirstElement(Association<T> e) {
        this.a = e;
    }

    public void add(T element) {
        Association<T> b = a;
        
        boolean found = false;
        while (b.getSuivant() != null) {
            if (b.getElement().equals(element)) {
                b.setFrequency(b.getFrequency() + 1);
                found = true;
                break;
            } else b = b.getSuivant();
        }

        if (!found) {
            b.setSuivant(new Association<T>(element, 1));
        }
    }

    @Override
    public String toString() {
        String str = "";
        
        Association<T> b = a;
        while (b.getSuivant() != null) {
            str += b.toString() + ", ";
            b = b.getSuivant();
        }

        str = str.substring(0, str.length() - 2);
        return str;
    }
}
