hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [04/16] hbase git commit: HBASE-17410 Changed size() == 0 to isEmpty in hbase-client
Date Sat, 07 Jan 2017 08:04:46 GMT
HBASE-17410 Changed size() == 0 to isEmpty in hbase-client

Signed-off-by: Josh Elser <elserj@apache.org>


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

Branch: refs/heads/hbase-12439
Commit: df98d8dcd76835e59fe6df43197308215028a41e
Parents: dba103e
Author: Jan Hentschel <jan.hentschel@ultratendency.com>
Authored: Wed Jan 4 18:29:33 2017 +0100
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Jan 5 11:45:18 2017 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/client/ClientScanner.java  | 4 ++--
 .../apache/hadoop/hbase/client/ClientSmallReversedScanner.java   | 4 ++--
 .../java/org/apache/hadoop/hbase/client/ClientSmallScanner.java  | 4 ++--
 .../java/org/apache/hadoop/hbase/client/HTableMultiplexer.java   | 2 +-
 .../src/main/java/org/apache/hadoop/hbase/client/Increment.java  | 2 +-
 .../src/main/java/org/apache/hadoop/hbase/client/Put.java        | 2 +-
 .../src/main/java/org/apache/hadoop/hbase/client/Scan.java       | 2 +-
 .../java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java  | 2 +-
 .../main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java  | 2 +-
 .../java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java | 4 ++--
 .../apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java   | 2 +-
 .../apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java | 4 ++--
 .../test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java  | 4 ++--
 13 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
index c4c86a6..283272a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java
@@ -350,10 +350,10 @@ public abstract class ClientScanner extends AbstractClientScanner {
 
   protected Result nextWithSyncCache() throws IOException {
     // If the scanner is closed and there's nothing left in the cache, next is a no-op.
-    if (cache.size() == 0 && this.closed) {
+    if (cache.isEmpty() && this.closed) {
       return null;
     }
-    if (cache.size() == 0) {
+    if (cache.isEmpty()) {
       loadCache();
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallReversedScanner.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallReversedScanner.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallReversedScanner.java
index ffa8af7..8f0c2f8 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallReversedScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallReversedScanner.java
@@ -193,10 +193,10 @@ public class ClientSmallReversedScanner extends ReversedClientScanner
{
   public Result next() throws IOException {
     // If the scanner is closed and there's nothing left in the cache, next is a
     // no-op.
-    if (cache.size() == 0 && this.closed) {
+    if (cache.isEmpty() && this.closed) {
       return null;
     }
-    if (cache.size() == 0) {
+    if (cache.isEmpty()) {
       loadCache();
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
index b5f373a..52a291b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientSmallScanner.java
@@ -216,10 +216,10 @@ public class ClientSmallScanner extends ClientSimpleScanner {
   public Result next() throws IOException {
     // If the scanner is closed and there's nothing left in the cache, next is a
     // no-op.
-    if (cache.size() == 0 && this.closed) {
+    if (cache.isEmpty() && this.closed) {
       return null;
     }
-    if (cache.size() == 0) {
+    if (cache.isEmpty()) {
       loadCache();
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
index c03b969..27393ba 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
@@ -569,7 +569,7 @@ public class HTableMultiplexer {
         // drain all the queued puts into the tmp list
         processingList.clear();
         queue.drainTo(processingList);
-        if (processingList.size() == 0) {
+        if (processingList.isEmpty()) {
           // Nothing to flush
           return;
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
index f4eede4..9538361 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
@@ -225,7 +225,7 @@ public class Increment extends Mutation implements Comparable<Row>
{
     StringBuilder sb = new StringBuilder();
     sb.append("row=");
     sb.append(Bytes.toStringBinary(this.row));
-    if(this.familyMap.size() == 0) {
+    if(this.familyMap.isEmpty()) {
       sb.append(", no columns set to be incremented");
       return sb.toString();
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
index 54480d1..a6ebd03 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
@@ -413,7 +413,7 @@ public class Put extends Mutation implements HeapSize, Comparable<Row>
{
   private boolean has(byte[] family, byte[] qualifier, long ts, byte[] value,
                       boolean ignoreTS, boolean ignoreValue) {
     List<Cell> list = getCellList(family);
-    if (list.size() == 0) {
+    if (list.isEmpty()) {
       return false;
     }
     // Boolean analysis of ignoreTS/ignoreValue.

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
index 2c69924..a2d9037 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
@@ -871,7 +871,7 @@ public class Scan extends Query {
   public Map<String, Object> getFingerprint() {
     Map<String, Object> map = new HashMap<String, Object>();
     List<String> families = new ArrayList<String>();
-    if(this.familyMap.size() == 0) {
+    if(this.familyMap.isEmpty()) {
       map.put("families", "ALL");
       return map;
     } else {

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
index 3549304..14d23d4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
@@ -61,7 +61,7 @@ public class FirstKeyOnlyFilter extends FilterBase {
   }
 
   public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments)
{
-    Preconditions.checkArgument(filterArguments.size() == 0,
+    Preconditions.checkArgument(filterArguments.isEmpty(),
                                 "Expected 0 but got: %s", filterArguments.size());
     return new FirstKeyOnlyFilter();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
index a22750d..adbf304 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java
@@ -75,7 +75,7 @@ public class KeyOnlyFilter extends FilterBase {
   }
   
   public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments)
{
-    Preconditions.checkArgument((filterArguments.size() == 0 || filterArguments.size() ==
1),
+    Preconditions.checkArgument((filterArguments.isEmpty() || filterArguments.size() == 1),
                                 "Expected: 0 or 1 but got: %s", filterArguments.size());
     KeyOnlyFilter filter = new KeyOnlyFilter();
     if (filterArguments.size() == 1) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
index 66556b0..768088b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
@@ -248,7 +248,7 @@ public class MultiRowRangeFilter extends FilterBase {
    * @return the ranges after sort and merge.
    */
   public static List<RowRange> sortAndMerge(List<RowRange> ranges) {
-    if (ranges.size() == 0) {
+    if (ranges.isEmpty()) {
       throw new IllegalArgumentException("No ranges found.");
     }
     List<RowRange> invalidRanges = new ArrayList<RowRange>();
@@ -391,7 +391,7 @@ public class MultiRowRangeFilter extends FilterBase {
       throwExceptionForInvalidRanges(invalidRanges, true);
     }
     // If no valid ranges found, throw the exception
-    if(newRanges.size() == 0) {
+    if(newRanges.isEmpty()) {
       throw new IllegalArgumentException("No valid ranges found.");
     }
     return newRanges;

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
index 9909d1f..bc26812 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
@@ -70,7 +70,7 @@ public class MultipleColumnPrefixFilter extends FilterBase {
 
   @Override
   public ReturnCode filterKeyValue(Cell kv) {
-    if (sortedPrefixes.size() == 0) {
+    if (sortedPrefixes.isEmpty()) {
       return ReturnCode.INCLUDE;
     } else {
       return filterColumn(kv);

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java
index dcbc0f0..7c548d9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueuesZKImpl.java
@@ -204,7 +204,7 @@ public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements
R
     String rsPath = ZKUtil.joinZNode(this.queuesZNode, regionserver);
     try {
       List<String> list = ZKUtil.listChildrenNoWatch(this.zookeeper, rsPath);
-      if (list != null && list.size() == 0){
+      if (list != null && list.isEmpty()){
         ZKUtil.deleteNode(this.zookeeper, rsPath);
       }
     } catch (KeeperException e) {
@@ -282,7 +282,7 @@ public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements
R
       }
 
       SortedSet<String> logQueue = new TreeSet<>();
-      if (wals == null || wals.size() == 0) {
+      if (wals == null || wals.isEmpty()) {
         listOfOps.add(ZKUtilOp.deleteNodeFailSilent(oldClusterZnode));
       } else {
         // create the new cluster znode

http://git-wip-us.apache.org/repos/asf/hbase/blob/df98d8dc/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
index 9f92f4f..f44fe9f 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java
@@ -132,7 +132,7 @@ public class TestHTableDescriptor {
     String className1 = "org.apache.hadoop.hbase.coprocessor.BaseRegionObserver";
     String className2 = "org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver";
     // Check that any coprocessor is present.
-    assertTrue(desc.getCoprocessors().size() == 0);
+    assertTrue(desc.getCoprocessors().isEmpty());
 
     // Add the 1 coprocessor and check if present.
     desc.addCoprocessor(className1);
@@ -153,7 +153,7 @@ public class TestHTableDescriptor {
 
     // Remove the last and check
     desc.removeCoprocessor(className2);
-    assertTrue(desc.getCoprocessors().size() == 0);
+    assertTrue(desc.getCoprocessors().isEmpty());
     assertFalse(desc.getCoprocessors().contains(className1));
     assertFalse(desc.getCoprocessors().contains(className2));
   }


Mime
View raw message