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 GitHub
parent 87f5cc5fa2
commit 2b1785458b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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