Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package program;
- import java.util.ArrayList;
- import java.util.List;
- public class Playlist {
- private List<Song> songs = new ArrayList<Song>();
- private String playlistName;
- public List<Song> getSongs() {
- return songs;
- }
- public void setSongs(List<Song> songs) {
- this.songs = songs;
- }
- public String getPlaylistName() {
- return playlistName;
- }
- public void setPlaylistName(String playlistName) {
- this.playlistName = playlistName;
- }
- @Override
- public String toString() {
- return "Playlist [songs=" + songs + ", playlistName=" + playlistName + "]";
- }
- public Playlist(List<Song> songs, String playlistName) {
- super();
- this.songs = songs;
- this.playlistName = playlistName;
- }
- public void add(Song song) {
- this.songs.add(song);
- }
- public Song get(int index) {
- return this.songs.get(index);
- }
- public Song remove(int index) {
- return this.songs.remove(index);
- }
- public void printPlaylist() {
- for (Song song : songs) {
- System.out.println(song);
- }
- System.out.println("------------------------------------");
- }
- }
Add Comment
Please, Sign In to add comment