Question
/** * Returns a subset of the larger playlist as an ArrayList of songs that * have the same genre. * @param song * @precondition
/** * Returns a subset of the larger playlist as an ArrayList of songs that * have the same genre. * @param song * @precondition the playlist is not empty. * @precondition the passed-in element is not null * @return an array list of all songs with the same genre. * * 1. if the playlist array is empty or the passed-in element is null, return null. * 2. otherwise: * a. create an ArrayList with generic type E to hold songs. * a. loop through the entire playlist array * i. if the current song has the same genre as what was passed in, * add it to the ArrayList. * 3. return the ArrayList. */ public ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started