Change switch to if (#10880)

Motivation:
switch is used when we have a good amount of cases because switch is faster than if-else. However, we're using only 1 case in switch which can affect performance.

Modification:
Changed switch to if.

Result:
Good code.
This commit is contained in:
Aayush Atharva 2020-12-22 23:55:33 +05:30 committed by Norman Maurer
parent 85ec20ecbd
commit ab340e1de0

View File

@ -478,12 +478,10 @@ public class DefaultHttpHeaders extends HttpHeaders {
}
break;
case 1:
switch (character) {
case '\n':
return 2;
default:
throw new IllegalArgumentException("only '\\n' is allowed after '\\r': " + seq);
if (character == '\n') {
return 2;
}
throw new IllegalArgumentException("only '\\n' is allowed after '\\r': " + seq);
case 2:
switch (character) {
case '\t':