import java.io.PrintStream; public class PlayList { private Song[] list; public PlayList() { this.list = new Song[0]; } public Song[] getList() { Song[] arrayOfSong = new Song[this.list.length]; for (int i = 0; i < this.list.length; i++) arrayOfSong[i] = this.list[i]; return arrayOfSong; } public void add(Song paramSong) { if (!inList(paramSong)) { Song[] arrayOfSong = new Song[this.list.length + 1]; for (int i = 0; i < this.list.length; i++) arrayOfSong[i] = this.list[i]; arrayOfSong[i] = paramSong; this.list = arrayOfSong; System.out.println(paramSong + " was added to the play list."); } else { System.out.println(paramSong + " is already in the play list."); } } public void remove(Song paramSong) { if (inList(paramSong)) { Song[] arrayOfSong = new Song[this.list.length - 1]; int i = 0; for (int j = 0; j < this.list.length; j++) { if (this.list[j].equals(paramSong)) continue; arrayOfSong[i] = this.list[j]; i++; } this.list = arrayOfSong; System.out.println(paramSong + " was removed from the play list."); } else { System.out.println(paramSong + " is not in the play list."); } } private boolean inList(Song paramSong) { int i = 0; for (int j = 0; (j < this.list.length) && (i == 0); j++) if (this.list[j].equals(paramSong)) i = 1; return i; } }import java.io.PrintStream; public class PlayList { private Song[] list; public PlayList() { this.list = new Song[0]; } public Song[] getList() { Song[] arrayOfSong = new Song[this.list.length]; for (int i = 0; i < this.list.length; i++) arrayOfSong[i] = this.list[i]; return arrayOfSong; } public void add(Song paramSong) { if (!inList(paramSong)) { Song[] arrayOfSong = new Song[this.list.length + 1]; for (int i = 0; i < this.list.length; i++) arrayOfSong[i] = this.list[i]; arrayOfSong[i] = paramSong; this.list = arrayOfSong; System.out.println(paramSong + " was added to the play list."); } else { System.out.println(paramSong + " is already in the play list."); } } public void remove(Song paramSong) { if (inList(paramSong)) { Song[] arrayOfSong = new Song[this.list.length - 1]; int i = 0; for (int j = 0; j < this.list.length; j++) { if (this.list[j].equals(paramSong)) continue; arrayOfSong[i] = this.list[j]; i++; } this.list = arrayOfSong; System.out.println(paramSong + " was removed from the play list."); } else { System.out.println(paramSong + " is not in the play list."); } } private boolean inList(Song paramSong) { int i = 0; for (int j = 0; (j < this.list.length) && (i == 0); j++) if (this.list[j].equals(paramSong)) i = 1; return i; } }