标签: hadoop mapreduce key-value
如何在If语句中比较两个LongWritable ???等,
if(compareTo(key1,new LongWritable(1)) { //do something; }
答案 0 :(得分:2)
LongWritable实现Comparable,所以使用compareTo方法:
if (lw1.compareTo(lw2) == 0) { // lw1 has same value as lw2 }