#1059 - Cleanup the core codebase.

Clean up code containing various patterns:

* Remove redundant `final`, `public`, and `static` declarations in interfaces and enums.
* Replace redundant `? extends Object` generic parameters with `?`.
* Convert collections to arrays using empty array instead of pre-sized one (modern JVM recommendation).
* Initialize collections using constructor call over `addAll`.
* Favor `addAll` over iterating and adding one-by-one.
* Take advantage of `Map.forEach` that was introduced with Java 8.
This commit is contained in:
Greg Turnquist
2019-08-30 15:32:13 -05:00
parent 9d83787a54
commit fff5396a1c
24 changed files with 94 additions and 103 deletions

View File

@@ -267,7 +267,7 @@ public class UriTemplate implements Iterable<TemplateVariable>, Serializable {
* @param parameters must not be {@literal null}.
* @return
*/
public URI expand(Map<String, ? extends Object> parameters) {
public URI expand(Map<String, ?> parameters) {
if (TemplateVariables.NONE.equals(variables)) {
return URI.create(baseUri);
@@ -373,8 +373,7 @@ public class UriTemplate implements Iterable<TemplateVariable>, Serializable {
} else if (value instanceof Map) {
((Map<Object, Object>) value).entrySet() //
.forEach(it -> builder.queryParam(it.getKey().toString(), it.getValue()));
((Map<Object, Object>) value).forEach((key, value1) -> builder.queryParam(key.toString(), value1));
} else {