Snippets Collections
List<String> songList = new ArrayList<>();
songList.add("Some song"); //Repeat until satisfied

System.out.println("\n\tWelcome! Please choose a song!");
String songChoice = scan.nextLine();
while (!songList.contains(songChoice)) {
    //Do stuff when input is not a recognised song
}
star

Wed Apr 01 2020 11:31:57 GMT+0000 (UTC) https://stackoverflow.com/questions/60967832/insert-arraylist-into-while-condition

#java #java #arraylists #while-loops #equala

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension