diff --git a/src/main/java/emissary/core/HDMobileAgent.java b/src/main/java/emissary/core/HDMobileAgent.java index 1edd6e3cbc..25b5001e04 100755 --- a/src/main/java/emissary/core/HDMobileAgent.java +++ b/src/main/java/emissary/core/HDMobileAgent.java @@ -260,7 +260,7 @@ protected void agentControl(final IServiceProviderPlace currentPlaceArg) { final List sprouts = atPlaceHD(currentPlace, toBeProcessed); // Add any sprouts collected from the payloads - if (sprouts.size() > 0) { + if (!sprouts.isEmpty()) { addPayload(sprouts); } } diff --git a/src/main/java/emissary/directory/DirectoryEntryMap.java b/src/main/java/emissary/directory/DirectoryEntryMap.java index 3f3dcf35a4..60874de35c 100644 --- a/src/main/java/emissary/directory/DirectoryEntryMap.java +++ b/src/main/java/emissary/directory/DirectoryEntryMap.java @@ -197,7 +197,7 @@ protected DirectoryEntry removeEntry(final String key, final String entryKey) { } // Remove the mapping if it is empty - if (list.size() == 0) { + if (list.isEmpty()) { this.remove(key); } } @@ -391,7 +391,7 @@ public List addCostToMatching(final String key, final int increment) { } // Put them back in order if something changed - if (ret.size() > 0) { + if (!ret.isEmpty()) { sort(); } diff --git a/src/main/java/emissary/directory/DirectoryXmlContainer.java b/src/main/java/emissary/directory/DirectoryXmlContainer.java index 912de462d9..a1853de7d7 100644 --- a/src/main/java/emissary/directory/DirectoryXmlContainer.java +++ b/src/main/java/emissary/directory/DirectoryXmlContainer.java @@ -91,7 +91,7 @@ public static Document buildProxyDocument(final IRemoteDirectory dir, final Stri } // Add them to the xml - if (list.size() > 0) { + if (!list.isEmpty()) { final Element listEl = list.getXml(); listEl.setAttribute(DATAID_ATTR, dataId); root.addContent(listEl); diff --git a/src/main/java/emissary/parser/SessionProducer.java b/src/main/java/emissary/parser/SessionProducer.java index 655407d3ba..13a861ae8a 100755 --- a/src/main/java/emissary/parser/SessionProducer.java +++ b/src/main/java/emissary/parser/SessionProducer.java @@ -68,7 +68,7 @@ public IBaseDataObject createAndLoadDataObject(DecomposedSession session, String IBaseDataObject dataObject = DataObjectFactory.getInstance(new Object[] {theData, sName}); // Pop default form if we have something to say - if (initialForms != null && initialForms.size() > 0) { + if (initialForms != null && !initialForms.isEmpty()) { dataObject.popCurrentForm(); // Add our stuff to the form stack for (int j = initialForms.size() - 1; j >= 0; j--) { @@ -77,7 +77,7 @@ public IBaseDataObject createAndLoadDataObject(DecomposedSession session, String } List sessionForms = session.getInitialForms(); - if (sessionForms != null && sessionForms.size() > 0) { + if (sessionForms != null && !sessionForms.isEmpty()) { dataObject.popCurrentForm(); for (int j = sessionForms.size() - 1; j >= 0; j--) { dataObject.pushCurrentForm(sessionForms.get(j)); diff --git a/src/main/java/emissary/pickup/PickUpPlace.java b/src/main/java/emissary/pickup/PickUpPlace.java index adcce1a440..21ce906feb 100755 --- a/src/main/java/emissary/pickup/PickUpPlace.java +++ b/src/main/java/emissary/pickup/PickUpPlace.java @@ -172,7 +172,7 @@ protected void configurePickUpPlace() { logger.debug("Pickup Canonical HOLD => {}, Pickup Canonical DONE => {}, Pickup Canonical ERROR => {}", holdingArea, doneArea, errorArea); initialFormValues = configG.findEntries("INITIAL_FORM"); - if (initialFormValues.size() < 1) { + if (initialFormValues.isEmpty()) { initialFormValues.add(Form.UNKNOWN); } diff --git a/src/main/java/emissary/pickup/PickUpSpace.java b/src/main/java/emissary/pickup/PickUpSpace.java index 0aeff09655..00d94a1314 100755 --- a/src/main/java/emissary/pickup/PickUpSpace.java +++ b/src/main/java/emissary/pickup/PickUpSpace.java @@ -110,7 +110,7 @@ public void closeSpace(String spaceName) { @Override @Nullable public String getSpaceName() { - if (openSpaceNames.size() > 0) { + if (!openSpaceNames.isEmpty()) { return openSpaceNames.get(0); } else { return null; @@ -141,7 +141,7 @@ public int getSpaceCount() { */ @Override public boolean take() { - if (openSpaceNames.size() == 0) { + if (openSpaceNames.isEmpty()) { logger.debug("Cannot perform 'take' when no spaces are available"); return false; } @@ -200,7 +200,7 @@ protected void cleanupFailedSpaces(List forceClosers) { closeSpace(s); } - if (closers.size() > 0) { + if (!closers.isEmpty()) { logger.debug("Cleaned up " + closers.size() + " workspace instances, " + openSpaceNames.size() + " remaining"); } } diff --git a/src/main/java/emissary/pool/MoveSpool.java b/src/main/java/emissary/pool/MoveSpool.java index 137feed38e..47320d5719 100755 --- a/src/main/java/emissary/pool/MoveSpool.java +++ b/src/main/java/emissary/pool/MoveSpool.java @@ -103,7 +103,7 @@ public void resetPool() { public void quit() { logger.warn("Purging the spool..."); synchronized (spool) { - if (spool.size() > 0) { + if (!spool.isEmpty()) { spool.clear(); } spool.notifyAll(); @@ -157,7 +157,7 @@ public void run() { logger.debug("Nothing in spool, time to wait..."); Thread.yield(); synchronized (spool) { - if (spool.size() == 0) { + if (spool.isEmpty()) { spool.wait(60000); } } diff --git a/src/main/java/emissary/util/magic/MagicNumberFactory.java b/src/main/java/emissary/util/magic/MagicNumberFactory.java index cc0185e652..c374627d49 100644 --- a/src/main/java/emissary/util/magic/MagicNumberFactory.java +++ b/src/main/java/emissary/util/magic/MagicNumberFactory.java @@ -81,7 +81,7 @@ public static List buildMagicNumberList(byte[] configData, @Nullabl continue; } try { - if (depth == 0 && extensions.size() > 0) { + if (depth == 0 && !extensions.isEmpty()) { if (finger == null) { extensions = null; extensions = new ArrayList<>(); @@ -111,7 +111,7 @@ public static List buildMagicNumberList(byte[] configData, @Nullabl if (currentDepth == depth) { parseAndStore(extensions, s, swallowParseException); } else if (currentDepth < depth) { - if (extensions.size() == 0) { + if (extensions.isEmpty()) { finger = null; currentDepth = -1; continue; @@ -150,7 +150,7 @@ public static List buildMagicNumberList(byte[] configData, @Nullabl } } } - if (finger != null && extensions.size() > 0) { + if (finger != null && !extensions.isEmpty()) { addExtensionsLayer(extensions, finger); } } catch (IOException ioe) { diff --git a/src/main/java/emissary/util/search/MultiKeywordScanner.java b/src/main/java/emissary/util/search/MultiKeywordScanner.java index a340d8237b..ff0dc41ea0 100755 --- a/src/main/java/emissary/util/search/MultiKeywordScanner.java +++ b/src/main/java/emissary/util/search/MultiKeywordScanner.java @@ -139,7 +139,7 @@ public HitList findNext(final byte[] dataArg, final int start, final int stop) { for (position = start + this.standardSkip - 1; position < stop; position += this.skipTable[get256Value(dataArg[position])]) { try { this.treeScanner.scan(dataArg, position, hits); - if (hits.size() > 0) { + if (!hits.isEmpty()) { break; } } catch (Exception e) {