如何在If语句中比较两个LongWritable?喜欢,
if(compareTo(key1,new LongWritable(1))
{
//do something;
}
最佳答案
LongWritable实现Comparable,因此请使用compareTo方法:
if (lw1.compareTo(lw2) == 0) {
// lw1 has same value as lw2
}
关于hadoop - 比较两个LongWritable in if语句,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16149331/