HBASE-17410 Changed size() == 0 to isEmpty in hbase-client

Signed-off-by: Josh Elser <elserj@apache.org>
This commit is contained in:
Jan Hentschel 2017-01-04 18:29:33 +01:00 committed by Josh Elser
parent dba103e1b6
commit df98d8dcd7
13 changed files with 19 additions and 19 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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.

View File

@ -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 {

View File

@ -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();
}

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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));
}