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 DataBase extends Serializable {
def containsArtist(artist: Artist): Boolean = _artists.contains(artist)
def getArtists(): Array[Artist] = _artists.toArray
def getArtistByName(name: String): Option[Artist] = {
for (artist: Artist <- _artists) {
if (artist.name == name) {
return Some(artist)
}
}
return None
}
override def toString: String = s"<Database: ${_artists.length} artist(s)>"
}