* 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

@@ -449,7 +449,7 @@ public class Connection {
}
_outboundPackets.notifyAll();
}
if ((acked != null) && (acked.size() > 0) )
if ((acked != null) && (!acked.isEmpty()) )
_ackSinceCongestion = true;
return acked;
}

View File

@@ -253,7 +253,7 @@ public class ConnectionPacketHandler {
else
return false;
if ( (acked != null) && (acked.size() > 0) ) {
if ( (acked != null) && (!acked.isEmpty()) ) {
if (_log.shouldLog(Log.DEBUG))
_log.debug(acked.size() + " of our packets acked with " + packet);
// use the highest RTT, since these would likely be bunched together,

View File

@@ -283,15 +283,15 @@ public class MessageInputStream extends InputStream {
expiration = _readTimeout + System.currentTimeMillis();
synchronized (_dataLock) {
for (int i = 0; i < length; i++) {
if ( (_readyDataBlocks.size() <= 0) && (i == 0) ) {
if ( (_readyDataBlocks.isEmpty()) && (i == 0) ) {
// ok, we havent found anything, so lets block until we get
// at least one byte
while (_readyDataBlocks.size() <= 0) {
while (_readyDataBlocks.isEmpty()) {
if (_locallyClosed)
throw new IOException("Already closed, you wanker");
if ( (_notYetReadyBlocks.size() <= 0) && (_closeReceived) ) {
if ( (_notYetReadyBlocks.isEmpty()) && (_closeReceived) ) {
if (_log.shouldLog(Log.INFO))
_log.info("read(...," + offset + ", " + length + ")[" + i
+ "] got EOF after " + _readTotal + " " + toString());
@@ -322,7 +322,7 @@ public class MessageInputStream extends InputStream {
+ ") with nonblocking setup: " + toString());
return i;
}
if (_readyDataBlocks.size() <= 0) {
if (_readyDataBlocks.isEmpty()) {
if ( (_readTimeout > 0) && (expiration < System.currentTimeMillis()) ) {
if (_log.shouldLog(Log.INFO))
_log.info("read(...," + offset+", " + length+ ")[" + i
@@ -334,7 +334,7 @@ public class MessageInputStream extends InputStream {
}
// we looped a few times then got data, so this pass doesnt count
i--;
} else if (_readyDataBlocks.size() <= 0) {
} else if (_readyDataBlocks.isEmpty()) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("read(...," + offset+", " + length+ ")[" + i
+ "] no more ready blocks, returning");

View File

@@ -70,9 +70,9 @@ public class PacketLocal extends Packet implements MessageOutputStream.WriteStat
* @deprecated I2PSession throws out the tags
*/
public void setTagsSent(Set tags) {
if (tags != null && tags.size() > 0)
if (tags != null && !tags.isEmpty())
_log.error("Who is sending tags thru the streaming lib? " + tags.size());
if ( (_tagsSent != null) && (_tagsSent.size() > 0) && (tags.size() > 0) ) {
if ( (_tagsSent != null) && (!_tagsSent.isEmpty()) && (!tags.isEmpty()) ) {
//int old = _tagsSent.size();
//_tagsSent.addAll(tags);
if (!_tagsSent.equals(tags))
@@ -160,7 +160,7 @@ public class PacketLocal extends Packet implements MessageOutputStream.WriteStat
if (con != null)
buf.append(" rtt ").append(con.getOptions().getRTT());
if ( (_tagsSent != null) && (_tagsSent.size() > 0) )
if ( (_tagsSent != null) && (!_tagsSent.isEmpty()) )
buf.append(" with tags");
if (_ackOn > 0)