Polish: anonymous inner classes containing only one method should become lambdas,

use getOrDefault instead of ternary operator
This commit is contained in:
igor-suhorukov
2018-02-16 10:02:33 +03:00
committed by Juergen Hoeller
parent aa4bcedad3
commit 2be4985b8f
11 changed files with 64 additions and 133 deletions

View File

@@ -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);
}
/**

View File

@@ -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