如何在If语句中比较两个LongWritable ??如,
if(compareTo(key1,new LongWritable(1))
{
//do something;
}
LongWritable实现Comparable,所以使用compareTo方法:
if (lw1.compareTo(lw2) == 0) {
// lw1 has same value as lw2
}