HBASE-16705 Eliminate long to Long auto boxing in LongComparator. (binlijin)
This commit is contained in:
parent
b7e0e15787
commit
da37fd9cdc
|
@ -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,13 +27,15 @@ 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));
|
||||
|
@ -44,14 +44,14 @@ public class LongComparator extends ByteArrayComparable {
|
|||
|
||||
@Override
|
||||
public int compareTo(byte[] value, int offset, int length) {
|
||||
Long that = Bytes.toLong(value, offset, length);
|
||||
return this.longValue.compareTo(that);
|
||||
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);
|
||||
long that = ByteBufferUtils.toLong(value, offset);
|
||||
return Long.compare(longValue, that);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue