diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java index 9c56772..6bd4b0f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java @@ -20,8 +20,6 @@ package org.apache.hadoop.hbase.filter; import java.nio.ByteBuffer; -import com.google.protobuf.InvalidProtocolBufferException; - import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.hbase.exceptions.DeserializationException; @@ -29,30 +27,32 @@ import org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos; import org.apache.hadoop.hbase.util.ByteBufferUtils; import org.apache.hadoop.hbase.util.Bytes; +import com.google.protobuf.InvalidProtocolBufferException; + /** * A long comparator which numerical compares against the specified byte array */ @InterfaceAudience.Public @InterfaceStability.Stable public class LongComparator extends ByteArrayComparable { - private Long longValue; + private long longValue; - public LongComparator(long value) { - super(Bytes.toBytes(value)); - this.longValue = value; - } + public LongComparator(long value) { + super(Bytes.toBytes(value)); + this.longValue = value; + } - @Override - public int compareTo(byte[] value, int offset, int length) { - Long that = Bytes.toLong(value, offset, length); - return this.longValue.compareTo(that); - } + @Override + public int compareTo(byte[] value, int offset, int length) { + long that = Bytes.toLong(value, offset, length); + return Long.compare(longValue, that); + } - @Override - public int compareTo(ByteBuffer value, int offset, int length) { - Long that = ByteBufferUtils.toLong(value, offset); - return this.longValue.compareTo(that); - } + @Override + public int compareTo(ByteBuffer value, int offset, int length) { + long that = ByteBufferUtils.toLong(value, offset); + return Long.compare(longValue, that); + } /** * @return The comparator serialized using pb