Your problem is that MyEntry<K, V>
doesn't tell the compiler what type of Object you're trying to compare. It doesn't know that you're comparing Long values. The best way to do this is to not worry about what type of Object you're comparing (assuming your object implements Comparable) by just using
return this.value.compareTo(object.value);
but if you want to do it manually for some reason, do this:
public int compareTo(MyEntry<K, V> object) {
if ((Long) this.value < (Long) object.value)
return -1;
if (this.value.equals(object.value))
return 0;
return 1;
}