Some very simple improvements regarding ArrayList
This commit is contained in:
parent
5e0cd9fb60
commit
92053bb84e
|
|
@ -138,8 +138,9 @@ abstract class AbstractJCacheOperation<A extends Annotation> implements JCacheOp
|
|||
|
||||
|
||||
private static List<CacheParameterDetail> initializeAllParameterDetails(Method method) {
|
||||
List<CacheParameterDetail> result = new ArrayList<>();
|
||||
for (int i = 0; i < method.getParameterCount(); i++) {
|
||||
int parameterCount = method.getParameterCount();
|
||||
List<CacheParameterDetail> result = new ArrayList<>(parameterCount);
|
||||
for (int i = 0; i < parameterCount; i++) {
|
||||
CacheParameterDetail detail = new CacheParameterDetail(method, i);
|
||||
result.add(detail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -936,8 +936,7 @@ public abstract class StringUtils {
|
|||
return array1;
|
||||
}
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
result.addAll(Arrays.asList(array1));
|
||||
List<String> result = new ArrayList<>(Arrays.asList(array1));
|
||||
for (String str : array2) {
|
||||
if (!result.contains(str)) {
|
||||
result.add(str);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -373,12 +374,13 @@ public class MessageHeaderAccessor {
|
|||
}
|
||||
|
||||
private List<String> getMatchingHeaderNames(String pattern, @Nullable Map<String, Object> headers) {
|
||||
if (headers == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> matchingHeaderNames = new ArrayList<>();
|
||||
if (headers != null) {
|
||||
for (String key : headers.keySet()) {
|
||||
if (PatternMatchUtils.simpleMatch(pattern, key)) {
|
||||
matchingHeaderNames.add(key);
|
||||
}
|
||||
for (String key : headers.keySet()) {
|
||||
if (PatternMatchUtils.simpleMatch(pattern, key)) {
|
||||
matchingHeaderNames.add(key);
|
||||
}
|
||||
}
|
||||
return matchingHeaderNames;
|
||||
|
|
|
|||
|
|
@ -317,8 +317,7 @@ public class ErrorsTag extends AbstractHtmlElementBodyTag implements BodyTag {
|
|||
*/
|
||||
@Override
|
||||
protected void exposeAttributes() throws JspException {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
errorMessages.addAll(Arrays.asList(getBindStatus().getErrorMessages()));
|
||||
List<String> errorMessages = new ArrayList<>(Arrays.asList(getBindStatus().getErrorMessages()));
|
||||
this.oldMessages = this.pageContext.getAttribute(MESSAGES_ATTRIBUTE, PageContext.PAGE_SCOPE);
|
||||
this.pageContext.setAttribute(MESSAGES_ATTRIBUTE, errorMessages, PageContext.PAGE_SCOPE);
|
||||
this.errorMessagesWereExposed = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue