Skip to content

Commit

Permalink
[core accumulo couchbase memcached] Fixing squid:S1155 - Collection.i…
Browse files Browse the repository at this point in the history
…sEmpty() should be used to test for emptiness
  • Loading branch information
kirill-vlasov committed Dec 31, 2015
1 parent 44d8cad commit 4fe3a37
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private void keyNotification(String key) throws KeeperException {
// 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ String consume() throws KeeperException, InterruptedException {
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 {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/com/yahoo/ycsb/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ else if (tokens[0].compareTo("scan")==0)
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private void decode(final Object source, final Set<String> fields,
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ protected static void fromJson(
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 */) {
Expand Down

0 comments on commit 4fe3a37

Please sign in to comment.