squid:S1155 - Collection.isEmpty() should be used to test for emptiness

This commit is contained in:
George Kankava
2016-07-02 10:36:39 +04:00
parent c7959ce63e
commit 5cc975522e
11 changed files with 19 additions and 19 deletions
@@ -140,7 +140,7 @@ public class DhcpInfoInternal {
dns2 = orig.dns2;
}
if (mRoutes.size() == 0) {
if (mRoutes.isEmpty()) {
for (RouteInfo route : orig.getRoutes()) {
addRoute(route);
}
@@ -81,7 +81,7 @@ public abstract class ElementTimeImpl implements ElementTime {
// Ignore badly formatted times
}
}
if (beginTimeList.size() == 0) {
if (beginTimeList.isEmpty()) {
/*
* What is the right default value?
*
@@ -139,7 +139,7 @@ public abstract class ElementTimeImpl implements ElementTime {
}
// "end" time is not specified
if (endTimeList.size() == 0) {
if (endTimeList.isEmpty()) {
// Get duration
float duration = getDur();
@@ -473,7 +473,7 @@ public class TransactionService extends Service implements Observer {
try {
synchronized (mProcessing) {
mProcessing.remove(transaction);
if (mPending.size() > 0) {
if (!mPending.isEmpty()) {
if (LOCAL_LOGV) Log.v(TAG, "update: handle next pending transaction...");
Message msg = mServiceHandler.obtainMessage(
EVENT_HANDLE_NEXT_PENDING_TRANSACTION,
@@ -799,7 +799,7 @@ public class TransactionService extends Service implements Observer {
public void markAllPendingTransactionsAsFailed() {
synchronized (mProcessing) {
while (mPending.size() != 0) {
while (!mPending.isEmpty()) {
Transaction transaction = mPending.remove(0);
transaction.mTransactionState.setState(TransactionState.FAILED);
if (transaction instanceof SendTransaction) {
@@ -824,7 +824,7 @@ public class TransactionService extends Service implements Observer {
int numProcessTransaction;
synchronized (mProcessing) {
if (mPending.size() != 0) {
if (!mPending.isEmpty()) {
transaction = mPending.remove(0);
}
numProcessTransaction = mProcessing.size();
@@ -131,7 +131,7 @@ public class DraftCache {
// If nobody's interested in finding out about changes,
// just bail out early.
synchronized (mChangeListenersLock) {
if (mChangeListeners.size() < 1) {
if (mChangeListeners.isEmpty()) {
return;
}
}
@@ -503,14 +503,14 @@ public class Contact {
while (true) {
Runnable r = null;
synchronized (mThingsToLoad) {
if (mThingsToLoad.size() == 0) {
if (mThingsToLoad.isEmpty()) {
try {
mThingsToLoad.wait();
} catch (InterruptedException ex) {
break; // Exception sent by Contact.init() to stop Runnable
}
}
if (mThingsToLoad.size() > 0) {
if (!mThingsToLoad.isEmpty()) {
r = mThingsToLoad.remove(0);
}
}
@@ -1175,7 +1175,7 @@ public class Contact {
}
}
}
if (candidates.size() == 0) {
if (candidates.isEmpty()) {
mContactsHash.remove(key);
}
}
@@ -110,7 +110,7 @@ class ExifData {
* Returns true if this header contains uncompressed strip.
*/
protected boolean hasUncompressedStrip() {
return mStripBytes.size() != 0;
return !mStripBytes.isEmpty();
}
/**
@@ -264,7 +264,7 @@ class ExifData {
}
}
}
if (ret.size() == 0) {
if (ret.isEmpty()) {
return null;
}
return ret;
@@ -287,7 +287,7 @@ class ExifData {
for (ExifTag t : tags) {
ret.add(t);
}
if (ret.size() == 0) {
if (ret.isEmpty()) {
return null;
}
return ret;
@@ -307,7 +307,7 @@ class ExifData {
}
}
}
if (ret.size() == 0) {
if (ret.isEmpty()) {
return null;
}
return ret;
@@ -2348,7 +2348,7 @@ public class ExifInterface {
l.add(ifds[i]);
}
}
if (l.size() <= 0) {
if (l.isEmpty()) {
return null;
}
int[] ret = new int[l.size()];
@@ -921,7 +921,7 @@ public class IabHelper {
}
}
if (skuList.size() == 0) {
if (skuList.isEmpty()) {
logDebug("queryPrices: nothing to do because there are no SKUs.");
return BILLING_RESPONSE_RESULT_OK;
}
@@ -282,7 +282,7 @@ public abstract class MediaModel extends Model implements EventListener {
}
public MediaAction getCurrentAction() {
if (0 == mMediaActions.size()) {
if (mMediaActions.isEmpty()) {
return MediaAction.NO_ACTIVE_ACTION;
}
return mMediaActions.remove(0);
@@ -208,7 +208,7 @@ public class DeliveryReportHelper {
return null;
}
if (reportReqs.size() == 0) {
if (reportReqs.isEmpty()) {
return null;
}
@@ -207,7 +207,7 @@ public class MMSSetupFragment extends QKFragment implements DialogFragmentListen
}
private void showConfigurationDialog() {
if (mAPNs.size() == 0) {
if (mAPNs.isEmpty()) {
// Give the user a support channel and further instructions if automatic
// configuration failed.
launchDialog(NO_CONFIGURATIONS_FOUND);