This commit is contained in:
2024-05-07 14:09:47 +02:00
parent 6d1d53e43c
commit 95b0479600
4 changed files with 198 additions and 0 deletions

View File

@@ -8,5 +8,14 @@ class Album(val name: String) extends Serializable {
def containsSong(song: Song): Boolean = _songs.contains(song)
def getSongs(): Array[Song] = _songs.toArray
def getSongByTitle(title: String): Option[Song] = {
for (song: Song <- _songs) {
if (song.title == title) {
return Some(song)
}
}
return None
}
override def toString: String = s"<Album '$name': ${_songs.length} song(s)>"
}