* Replace size() <= 0 with isEmpty() everywhere, ditto > 0 -> !isEmpty()

This commit is contained in:
zzz
2010-05-05 16:51:54 +00:00
parent 16bec08f09
commit 2baee7413c
90 changed files with 158 additions and 154 deletions

View File

@ -88,7 +88,7 @@ public class ConfigClientsHelper extends HelperBase {
String app = name.substring(PluginStarter.PREFIX.length(), name.lastIndexOf(PluginStarter.ENABLED));
String val = props.getProperty(name);
Properties appProps = PluginStarter.pluginProperties(_context, app);
if (appProps.size() <= 0)
if (appProps.isEmpty())
continue;
StringBuilder desc = new StringBuilder(256);
desc.append("<table border=\"0\">")

View File

@ -70,7 +70,7 @@ public class ConfigStatsHelper extends HelperBase {
* @return true if a valid stat is available, otherwise false
*/
public boolean hasMoreStats() {
if (_stats.size() <= 0)
if (_stats.isEmpty())
return false;
_currentIsGraphed = false;
_currentStatName = (String)_stats.remove(0);

View File

@ -163,7 +163,7 @@ public class ConfigTunnelsHelper extends HelperBase {
// TunnelPoolOptions, so make the boxes readonly.
// And let's not display them at all unless they have contents, which should be rare.
Properties props = in.getUnknownOptions();
if (props.size() > 0) {
if (!props.isEmpty()) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Inbound options") + ":</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +
@ -176,7 +176,7 @@ public class ConfigTunnelsHelper extends HelperBase {
buf.append("\"></td></tr>\n");
}
props = out.getUnknownOptions();
if (props.size() > 0) {
if (!props.isEmpty()) {
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Outbound options") + ":</td>\n" +
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"true\" " +

View File

@ -6,9 +6,11 @@ import net.i2p.data.Hash;
import net.i2p.router.RouterContext;
class ContextHelper {
/** @throws IllegalStateException if no context available */
public static RouterContext getContext(String contextId) {
List contexts = RouterContext.listContexts();
if ( (contexts == null) || (contexts.size() <= 0) )
if ( (contexts == null) || (contexts.isEmpty()) )
throw new IllegalStateException("No contexts. This is usually because the router is either starting up or shutting down.");
if ( (contextId == null) || (contextId.trim().length() <= 0) )
return (RouterContext)contexts.get(0);

View File

@ -185,7 +185,7 @@ public class NetDbRenderer {
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><th colspan=\"3\">").append(_("Network Database Router Statistics")).append("</th><tr><td>");
// versions table
List<String> versionList = new ArrayList(versions.objects());
if (versionList.size() > 0) {
if (!versionList.isEmpty()) {
Collections.sort(versionList, Collections.reverseOrder(new VersionComparator()));
buf.append("<table>\n");
buf.append("<tr><th>" + _("Version") + "</th><th>" + _("Count") + "</th></tr>\n");
@ -217,7 +217,7 @@ public class NetDbRenderer {
// country table
List<String> countryList = new ArrayList(countries.objects());
if (countryList.size() > 0) {
if (!countryList.isEmpty()) {
Collections.sort(countryList, new CountryComparator());
buf.append("<table>\n");
buf.append("<tr><th align=\"left\">" + _("Country") + "</th><th>" + _("Count") + "</th></tr>\n");

View File

@ -322,7 +322,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
handler = new UpdateHandler((RouterContext)_context);
} else {
List contexts = RouterContext.listContexts();
if (contexts.size() > 0)
if (!contexts.isEmpty())
handler = new UpdateHandler((RouterContext)contexts.get(0));
else
_log.log(Log.CRIT, "No router context to update with?");

View File

@ -58,7 +58,7 @@ public class ShitlistRenderer {
else
buf.append(_("Banned until restart or in {0}", expireString));
Set transports = entry.transports;
if ( (transports != null) && (transports.size() > 0) )
if ( (transports != null) && (!transports.isEmpty()) )
buf.append(" on the following transport: ").append(transports);
if (entry.cause != null) {
buf.append("<br>\n");

View File

@ -373,7 +373,7 @@ public class SummaryHelper extends HelperBase {
StringBuilder buf = new StringBuilder(512);
buf.append("<h3><a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\">");
if (clients.size() > 0) {
if (!clients.isEmpty()) {
Collections.sort(clients, new AlphaComparator());
buf.append("<table>");

View File

@ -201,15 +201,17 @@ public class TunnelRenderer {
out.write("</table>\n");
if (in != null) {
List pending = in.listPending();
if (pending.size() > 0)
if (!pending.isEmpty()) {
out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("inbound") + "</b></center></div>\n");
live += pending.size();
live += pending.size();
}
}
if (outPool != null) {
List pending = outPool.listPending();
if (pending.size() > 0)
if (!pending.isEmpty()) {
out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("outbound") + "</b></center></div>\n");
live += pending.size();
live += pending.size();
}
}
if (live <= 0)
out.write("<div class=\"statusnotes\"><center><b>" + _("No tunnels; waiting for the grace period to end.") + "</center></b></div>\n");