32 lines
572 B
Java
32 lines
572 B
Java
|
public class Association<T> {
|
||
|
private T element;
|
||
|
private int frequency;
|
||
|
|
||
|
|
||
|
public Association(T e, int f) {
|
||
|
this.element = e;
|
||
|
this.frequency = f;
|
||
|
}
|
||
|
|
||
|
public void setElement(T e) {
|
||
|
this.element = e;
|
||
|
}
|
||
|
|
||
|
public T getElement() {
|
||
|
return this.element;
|
||
|
}
|
||
|
|
||
|
public void setFrequency(int f) {
|
||
|
this.frequency = f;
|
||
|
}
|
||
|
|
||
|
public int getFrequency() {
|
||
|
return this.frequency;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
return "[" + this.element + ", " + this.frequency + "]";
|
||
|
}
|
||
|
}
|