Question: Playlist.java import java.util.ArrayList; public class Playlist { private String name; private ArrayList videoTitles; * Initializes playlist with the specified name and creates an empty ArrayList.

Playlist.java

import java.util.ArrayList;

public class Playlist { private String name; private ArrayList videoTitles;

* Initializes playlist with the specified name and creates an empty ArrayList. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.*/ public Playlist(String name) { } * Get method for name */ public String getName() { } * Initializes the current object so changes to the current object will not affect the parameter object.*/ public Playlist(Playlist playlist) { } * Provided; please don't modify. toString for class */ public String toString() { String answer = "Playlist Name: " + name + " ";

answer += "VideoTitles: " + videoTitles;

return answer; } * Adds the title to the Arraylist storing titles. We can add the same video title several times. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing. */ public boolean addToPlaylist(String videoTitle) { }

/** * Get method for the ArrayList of titles. You must avoid privacy leaks. * * @return ArrayList with titles */ public ArrayList getPlaylistVideosTitles() { throw new UnsupportedOperationException("Implement this method"); } * Removes all instances of the title parameter from the ArrayList of titles. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing.@param videoTitle @return true if the ArrayList (videoTitles) was changed as a result of calling this method and false otherwise.*/ public boolean removeFromPlaylistAll(String videoTitle) { } * Randomizes the list of titles using a random parameter and Collections.shuffle. If the parameter is null, call Collections.shuffle with just the ArrayList.*/ public void shuffleVideoTitles(Random random) { } }

Video.java

import java.util.ArrayList;

public class Video implements Comparable

{ private String title, url; private int durationInMinutes; private Genre videoGenre; private ArrayList comments;

* Initializes a video object. If any parameter is null or if a string parameter is a blank (according to String class isBlank() method), the method will throw an IllegalArgumentException (with any message) and perform no processing. Also the same exception will be thrown if the duration is zero or negative.*/ public Video(String title, String url, int durationInMinutes, Genre videoGenre) { } * Initializes the Video object so changes to the parameter do not affect the current object. Your implementation must be efficient (avoid any unnecessary copies).* public Video(Video video) { } * Get method for title* public String getTitle() { } * Get method for url*/ public String getUrl() { throw new UnsupportedOperationException("Implement this method"); } * Get method for duration */ public int getDurationInMinutes() { } * Get method for video genre*/ public Genre getGenre() { }

public String toString() { String answer = "Title: " + "\"" + title + "\" ";

answer += "Url: " + url + " "; answer += "Duration (minutes): " + durationInMinutes + " "; answer += "Genre: " + videoGenre + " ";

return answer; } * Adds specified comments to the video. If the parameter is null or is a blank string (according to String class isBlank() method) the method will throw an IllegalArgumentException (with any message) and perform no processing. @param comments @return true if comments added; false otherwise */ public boolean addComments(String comments) { } * Returns copy so changes to the copy does not affect the original. Your implementation must be efficient (avoid any unnecessary copies). @return ArrayList of strings public ArrayList getComments() { } * Videos will be compared using title. If we were to sort an ArrayList of Videos, they will appear in lexicographical (alphabetical) order (e.g, "A","B", "C").@return negative, 0, or positive value public int compareTo(Video video) { } * Two Video objects are considered equal if they have the same title. Implement the method using the instanceof operator rather than using getClass(). @return true if objects are considered equal; false otherwise @Override public boolean equals(Object obj) { } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!