Skip to content

Commit

Permalink
Avoid unnecessary boxing/unboxing of primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
stsypanov authored and sbrannen committed May 15, 2020
1 parent 5672651 commit 703d546
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ else if (isUnicodeCharacterSequence(text)) {
setAsUnicode(text);
}
else if (text.length() == 1) {
setValue(Character.valueOf(text.charAt(0)));
setValue(text.charAt(0));
}
else {
throw new IllegalArgumentException("String [" + text + "] with length " +
Expand All @@ -103,7 +103,7 @@ private boolean isUnicodeCharacterSequence(String sequence) {

private void setAsUnicode(String text) {
int code = Integer.parseInt(text.substring(UNICODE_PREFIX.length()), 16);
setValue(Character.valueOf((char) code));
setValue((char) code);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void determinePoolSizeRange(ThreadPoolTaskExecutor executor) {
}
}
else {
Integer value = Integer.valueOf(this.poolSize);
int value = Integer.parseInt(this.poolSize);
corePoolSize = value;
maxPoolSize = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected void writeResourceRegion(ResourceRegion region, HttpOutputMessage outp

long start = region.getPosition();
long end = start + region.getCount() - 1;
Long resourceLength = region.getResource().contentLength();
long resourceLength = region.getResource().contentLength();
end = Math.min(end, resourceLength - 1);
long rangeLength = end - start + 1;
responseHeaders.add("Content-Range", "bytes " + start + '-' + end + '/' + resourceLength);
Expand Down Expand Up @@ -201,10 +201,10 @@ private void writeResourceRegionCollection(Collection<ResourceRegion> resourceRe
print(out, "--" + boundaryString);
println(out);
if (contentType != null) {
print(out, "Content-Type: " + contentType.toString());
print(out, "Content-Type: " + contentType);
println(out);
}
Long resourceLength = region.getResource().contentLength();
long resourceLength = region.getResource().contentLength();
end = Math.min(end, resourceLength - inputStreamPosition - 1);
print(out, "Content-Range: bytes " +
region.getPosition() + '-' + (region.getPosition() + region.getCount() - 1) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public BeanDefinition parse(Element element, ParserContext context) {
handlerMappingDef.getPropertyValues().add("contentNegotiationManager", contentNegotiationManager);

if (element.hasAttribute("enable-matrix-variables")) {
Boolean enableMatrixVariables = Boolean.valueOf(element.getAttribute("enable-matrix-variables"));
boolean enableMatrixVariables = Boolean.parseBoolean(element.getAttribute("enable-matrix-variables"));
handlerMappingDef.getPropertyValues().add("removeSemicolonContent", !enableMatrixVariables);
}

Expand Down

0 comments on commit 703d546

Please sign in to comment.