#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

@@ -202,8 +202,7 @@ public class Link implements Serializable {
Assert.notNull(affordance, "Affordance must not be null!");
List<Affordance> newAffordances = new ArrayList<>();
newAffordances.addAll(this.affordances);
List<Affordance> newAffordances = new ArrayList<>(this.affordances);
newAffordances.add(affordance);
return withAffordances(newAffordances);
@@ -281,7 +280,7 @@ public class Link implements Serializable {
* @param arguments must not be {@literal null}.
* @return
*/
public Link expand(Map<String, ? extends Object> arguments) {
public Link expand(Map<String, ?> arguments) {
return new Link(template.expand(arguments).toString(), getRel());
}