From 954e9013600edbef97bdb9d2ffeb38d82d934db1 Mon Sep 17 00:00:00 2001 From: Hammy Date: Tue, 22 Dec 2020 07:33:08 +0000 Subject: [PATCH] Modifying scope of member variables --- Design Patterns/src/composite/Song.java | 6 +++--- Design Patterns/src/composite/SongIterator.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Design Patterns/src/composite/Song.java b/Design Patterns/src/composite/Song.java index 60bba0c..c223539 100644 --- a/Design Patterns/src/composite/Song.java +++ b/Design Patterns/src/composite/Song.java @@ -2,9 +2,9 @@ package composite; public class Song extends SongComponent { - String songName; - String bandName; - int releaseYear; + private final String songName; + private final String bandName; + private final int releaseYear; public Song(String songName, String bandName, int releaseYear){ this.songName = songName; diff --git a/Design Patterns/src/composite/SongIterator.java b/Design Patterns/src/composite/SongIterator.java index 489b472..28b0435 100644 --- a/Design Patterns/src/composite/SongIterator.java +++ b/Design Patterns/src/composite/SongIterator.java @@ -4,7 +4,7 @@ import java.util.Iterator; import java.util.List; public class SongIterator implements Iterator { - List playList; + private final List playList; private int currentIndex = 0; public SongIterator(List playList) {