From 59cf558252babf403b5ae5fb9ea82521b729f8a5 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 24 Jan 2021 21:02:19 +0300 Subject: [PATCH] Adding qualifications to fields and variables 1. Added modifier final to fields name, tracks, musicians on 22-24 lines; 2. Renaming copy() method variables because they are completely identical to the names of class fields name, tracks, musicians declared on the 22-24 lines --- .../java8/examples/chapter1/Album.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/insightfullogic/java8/examples/chapter1/Album.java b/src/main/java/com/insightfullogic/java8/examples/chapter1/Album.java index 9cdeacea..66480dd9 100644 --- a/src/main/java/com/insightfullogic/java8/examples/chapter1/Album.java +++ b/src/main/java/com/insightfullogic/java8/examples/chapter1/Album.java @@ -19,9 +19,9 @@ */ public final class Album implements Performance { - private String name; - private List tracks; - private List musicians; + private final String name; + private final List tracks; + private final List musicians; public Album(String name, List tracks, List musicians) { Objects.requireNonNull(name); @@ -73,9 +73,9 @@ public Artist getMainMusician() { } public Album copy() { - List tracks = getTracks().map(Track::copy).collect(toList()); - List musicians = getMusicians().map(Artist::copy).collect(toList()); - return new Album(name, tracks, musicians); + List copiesTracks = getTracks().map(Track::copy).collect(toList()); + List copiesMusicians = getMusicians().map(Artist::copy).collect(toList()); + return new Album(name, copiesTracks, copiesMusicians); } }