Polish: anonymous inner classes containing only one method should become lambdas,
use getOrDefault instead of ternary operator
This commit is contained in:
committed by
Juergen Hoeller
parent
aa4bcedad3
commit
2be4985b8f
@@ -99,12 +99,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
*/
|
||||
@Override
|
||||
protected Comparator<RequestMappingInfo> getMappingComparator(final HttpServletRequest request) {
|
||||
return new Comparator<RequestMappingInfo>() {
|
||||
@Override
|
||||
public int compare(RequestMappingInfo info1, RequestMappingInfo info2) {
|
||||
return info1.compareTo(info2, request);
|
||||
}
|
||||
};
|
||||
return (info1, info2) -> info1.compareTo(info2, request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -512,12 +512,7 @@ public class MvcUriComponentsBuilder {
|
||||
}
|
||||
|
||||
// We may not have all URI var values, expand only what we have
|
||||
return builder.build().expand(new UriComponents.UriTemplateVariables() {
|
||||
@Override
|
||||
public Object getValue(@Nullable String name) {
|
||||
return uriVars.containsKey(name) ? uriVars.get(name) : UriComponents.UriTemplateVariables.SKIP_VALUE;
|
||||
}
|
||||
});
|
||||
return builder.build().expand(name -> uriVars.getOrDefault(name, UriComponents.UriTemplateVariables.SKIP_VALUE));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user