1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rainbow [258]
3 years ago
4

Write a method called listSearch() that takes in a target string and a list of other strings. This method returns a (possibly sh

orter) list containing all of the strings from the original list that themselves contain the target string you are searching for. Check for the target string as a case-sensitive substring of every member of the list. You can either modify the provided list or create a new one.
Computers and Technology
1 answer:
Alik [6]3 years ago
4 0

Answer:

public static List<String> listSearch(String searchFor, List<String> list){

    List<String> foundList = new ArrayList<String>();

   

    for(String s:list){

        if(s.contains(searchFor)){

            foundList.add(s);

        }

    }

    return foundList;

}

Explanation:

Create a method named listSearch that takes two parameters, a String named searchFor and a String list named list

Inside the method, initialize a new String list named foundList, this will be used to hold the strings that contains the target string. Create a for loop that iterates through the list. Check if a string in the list contains the searchFor using the contains method. If it does, add the string to the foundList. When the loop is done, return the foundList.

You might be interested in
This semester we looked at three languages (C++, Java and Python). One common rule in all three class checklists (for C++, Java
Marysya12 [62]

Answer:

The languages C++, Java, Python are Object Oriented Programming languages. What this means is that we create classes and then instantiate those classes. In C++ and Java, we use the new operator to instantiate the classes. So, if we want to display some data when we try to print the instance just like we print the variables of data types like int, double, string etc, we need to define what we need to display. It is because, class are just like data types like int, double etc. But as they are defined by the developer according to his/her needs, so the developer has to define what to print when they are printed.

5 0
3 years ago
Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
svlad2 [7]
A copy and paste would be fastest and easiest. As you can pinpoint the exact location to where you want the picture to be. 
5 0
3 years ago
Read 2 more answers
Name all the keys of the home row.
Kaylis [27]

Answer:

Search key, a, s, d, f, g, h, j, k, l, : and ;, ¨ and ´, and the enter key.

5 0
3 years ago
Describe the components of the Ethernet frame in detail?
Marta_Voda [28]
Starts with an Ethernet header, which contains destination and source MAC addresses as its first two fields
7 0
4 years ago
Show me the way to go home. If you want to find a webpage go to a search engine. Telling a "do engine" If you want to get someth
Gwar [14]

Do engine, is basically like WikiHow or Howstuff works, it just tells people how to do things.

Hope this was the answer you were looking for. Have a nice day!

3 0
3 years ago
Other questions:
  • Consider the scenario below and determine the most likely source of the problem. A user reports that her or his printer is not r
    13·2 answers
  • George and Miguel want to know more about their local and online competitors and about the retail industry. What is the best way
    9·1 answer
  • In class, we discussed static local variables in C. Answereach question below; if necessary, find and consult a reference on the
    10·1 answer
  • 4.12 LAB: Using math methods Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to
    10·1 answer
  • The process of providing only the essentials and hiding the details is known as _____. a. algorithm b. data structure c. abstrac
    6·1 answer
  • Write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space
    13·1 answer
  • Edhesive assignment 7 calendar
    10·1 answer
  • Example of language processor software
    8·1 answer
  • what impact of information communication technology have on the environment about electronic waste, use of electricity?​
    9·1 answer
  • Match the Job description with the job titles.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!