
be.bagofwords.util.KeyValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bow-utils Show documentation
Show all versions of bow-utils Show documentation
Utility classes that are used in the count-db project and other bow-* projects
package be.bagofwords.util;
import java.io.Serializable;
public class KeyValue implements Comparable>, Serializable {
private long key;
private T value;
public KeyValue(long key, T value) {
this.key = key;
this.value = value;
}
public long getKey() {
return key;
}
public T getValue() {
return value;
}
@Override
public int compareTo(KeyValue o) {
return Long.compare(getKey(), o.getKey());
}
@Override
public boolean equals(Object o) {
if (o instanceof KeyValue) {
return getKey() == ((KeyValue) o).getKey();
} else {
return false;
}
}
@Override
public String toString() {
return Long.toString(key);
}
//Serialization
public KeyValue() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy