Prefer isEmpty() over size() == 0
This commit is contained in:
parent
67f1d9a23d
commit
53cecdb31b
@ -562,7 +562,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
|
||||
char firstChar = line.charAt(0);
|
||||
if (lastHeader != null && (firstChar == ' ' || firstChar == '\t')) {
|
||||
List<String> current = trailer.getHeaders(lastHeader);
|
||||
if (current.size() != 0) {
|
||||
if (!current.isEmpty()) {
|
||||
int lastPos = current.size() - 1;
|
||||
String newString = current.get(lastPos) + line.trim();
|
||||
current.set(lastPos, newString);
|
||||
|
@ -374,8 +374,7 @@ public class HttpPostRequestDecoder {
|
||||
throw new EndOfDataDecoderException();
|
||||
}
|
||||
}
|
||||
return bodyListHttpData.size() > 0 &&
|
||||
bodyListHttpDataRank < bodyListHttpData.size();
|
||||
return !bodyListHttpData.isEmpty() && bodyListHttpDataRank < bodyListHttpData.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -405,7 +405,7 @@ public class HttpPostRequestEncoder implements ChunkedInput {
|
||||
duringMixedMode = false;
|
||||
}
|
||||
InternalAttribute internal = new InternalAttribute();
|
||||
if (multipartHttpDatas.size() > 0) {
|
||||
if (!multipartHttpDatas.isEmpty()) {
|
||||
// previously a data field so CRLF
|
||||
internal.addValue("\r\n");
|
||||
}
|
||||
@ -430,7 +430,7 @@ public class HttpPostRequestEncoder implements ChunkedInput {
|
||||
} else if (data instanceof FileUpload) {
|
||||
FileUpload fileUpload = (FileUpload) data;
|
||||
InternalAttribute internal = new InternalAttribute();
|
||||
if (multipartHttpDatas.size() > 0) {
|
||||
if (!multipartHttpDatas.isEmpty()) {
|
||||
// previously a data field so CRLF
|
||||
internal.addValue("\r\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user