Reputation: 6139
I am trying to emit 2 matrices as my key and value. One matrix as key and the other as value. I wrote my class which implements WritableComparable.
But I am confused what to write with in:
@Override
public int compareTo(MW o) {
// TODO Auto-generated method stub
return 0;
}
What is this CompareTo() intended for?
Upvotes: 0
Views: 981
Reputation: 20969
To cite the Java documentation:
This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
Usually you return 0 if both objects are the same, and with a number higher or lower you determine the order between your objects.
Upvotes: 1