forked from teddyzhang1976/ThinkInJava4thSampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSongService.java
More file actions
22 lines (21 loc) · 793 Bytes
/
SongService.java
File metadata and controls
22 lines (21 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//: gui/flex/SongService.java
package gui.flex;
import java.util.*;
public class SongService {
private List<Song> songs = new ArrayList<Song>();
public SongService() { fillTestData(); }
public List<Song> getSongs() { return songs; }
public void addSong(Song song) { songs.add(song); }
public void removeSong(Song song) { songs.remove(song); }
private void fillTestData() {
addSong(new Song("Chocolate", "Snow Patrol",
"Final Straw", "sp-final-straw.jpg",
"chocolate.mp3"));
addSong(new Song("Concerto No. 2 in E", "Hilary Hahn",
"Bach: Violin Concertos", "hahn.jpg",
"bachviolin2.mp3"));
addSong(new Song("'Round Midnight", "Wes Montgomery",
"The Artistry of Wes Montgomery",
"wesmontgomery.jpg", "roundmidnight.mp3"));
}
} ///:~