You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2016/09/29 06:57:03 UTC

[18/50] [abbrv] hbase git commit: HBASE-16705 Eliminate long to Long auto boxing in LongComparator. (binlijin)

HBASE-16705 Eliminate long to Long auto boxing in LongComparator. (binlijin)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/da37fd9c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/da37fd9c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/da37fd9c

Branch: refs/heads/hbase-14439
Commit: da37fd9cdc9cd3bffa6a863be45dff4ba49be89e
Parents: b7e0e15
Author: anoopsamjohn <an...@gmail.com>
Authored: Mon Sep 26 11:11:52 2016 +0530
Committer: anoopsamjohn <an...@gmail.com>
Committed: Mon Sep 26 11:11:52 2016 +0530

----------------------------------------------------------------------
 .../hadoop/hbase/filter/LongComparator.java     | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/da37fd9c/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java
----------------------------------------------------------------------
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