Skip to content
Snippets Groups Projects
Commit 6c26a387 authored by Sean Busbey's avatar Sean Busbey
Browse files

Merge pull request #565 from...

Merge pull request #565 from DevFactory/staging/Collection-isEmpty-should-be-used-to-test-for-emptiness-fix-9

Collection.isEmpty() should be used to test for emptiness
parents 5b72fb01 4fe3a37d
No related branches found
No related tags found
No related merge requests found
......@@ -416,7 +416,7 @@ public class AccumuloClient extends DB {
// If the results are empty, the key is enqueued in
// Zookeeper
// and tried again, until the results are found.
if (result.size() == 0) {
if (result.isEmpty()) {
q.produce(strKey);
int count = ((Integer) hmKeyNumReads.get(strKey)).intValue();
hmKeyNumReads.put(strKey, new Integer(count + 1));
......
......@@ -174,7 +174,7 @@ public class ZKProducerConsumer implements Watcher {
while (true) {
synchronized (mutex) {
List<String> list = zk.getChildren(getRoot(), true);
if (list.size() == 0) {
if (list.isEmpty()) {
System.out.println("Going to wait");
mutex.wait();
} else {
......
......@@ -327,7 +327,7 @@ public class CommandLine
Status ret=db.scan(table,tokens[1],Integer.parseInt(tokens[2]),fields,results);
System.out.println("Result: "+ret.getName());
int record=0;
if (results.size()==0)
if (results.isEmpty())
{
System.out.println("0 records");
}
......
......@@ -291,7 +291,7 @@ public class CouchbaseClient extends DB {
if (useJson) {
try {
JsonNode json = JSON_MAPPER.readTree((String) source);
boolean checkFields = fields != null && fields.size() > 0;
boolean checkFields = fields != null && !fields.isEmpty();
for (Iterator<Map.Entry<String, JsonNode>> jsonFields = json.fields(); jsonFields.hasNext();) {
Map.Entry<String, JsonNode> jsonField = jsonFields.next();
String name = jsonField.getKey();
......
......@@ -262,7 +262,7 @@ public class MemcachedClient extends DB {
String value, Set<String> fields,
Map<String, ByteIterator> result) throws IOException {
JsonNode json = MAPPER.readTree(value);
boolean checkFields = fields != null && fields.size() > 0;
boolean checkFields = fields != null && !fields.isEmpty();
for (Iterator<Map.Entry<String, JsonNode>> jsonFields = json.getFields();
jsonFields.hasNext();
/* increment in loop body */) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment