Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Find character in word in list of words and remove from original list and add to new list (java) I have a list of words
Find character in word in list of words and remove from original list and add to new list (java)
I have a list of words that I've turned into a string array. I ask the user to enter a character, and my code must find whether that character is in one of the words in the list of words and add that word to a new list and removed from the original list. How do I do that? Here's
String[] temps2 = newList.toArray(new String[0]); //turns list to string array. System.out.println(" pick a letter."); letter_1 = input.next()charAt(0); for (String b : temps2){ for(char ch : b.toCharArray()){ if letter_1==ch){ temps2.remove(b);//don't think you can do that.
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