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
eduard
3 years ago
11

Write a method called removeInRange that accepts four parameters: an ArrayList of integers, an element value, a starting index,

and an ending index. The method's behavior is to remove all occurrences of the given element that appear in the list between the starting index (inclusive) and the ending index (exclusive). Other values and occurrences of the given value that appear outside the given index range are not affected. For example, for the list [0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 10, 0, 12, 0, 14, 0, 16], a call of removeInRange(list, 0, 5, 13); should produce the list [0, 0, 2, 0, 4, 6, 8, 10, 12, 0, 14, 0, 16]. Notice that the zeros located at indices betwee
Computers and Technology
1 answer:
Murrr4er [49]3 years ago
7 0

Answer:

public static void removeInRange(List<Integer> list, int value, int start, int end) {

       for (int i = end - 1; i >= start; i--) {

           if (list.get(i) == value) {

               list.remove(i);

           }

       }

       System.out.println(list);

   }

Explanation:

- Create a method named <em>removeInRange</em> that takes four parameters, a list, an integer number, a starting index and an ending index

- Inside the method, initialize a <u>for loop</u> that iterates between starting index and ending index

- If any number between these ranges is equal to the given <em>value</em>, then remove that value from the list, using <u>remove</u> method

- When the loop is done, print the new list

You might be interested in
Flexplace and telecommuting are similar in that both allow you to _____. work in a location away from the office work different
viva [34]
Flexplace and telecommuting are similar in that both allow you to work in a different location four days a week. 
3 0
3 years ago
Can someone please do a java computer science program for me? I’m desperate and I did not have enough time to learn the topic. I
vagabundo [1.1K]
Sure, how would you like me to send you the code?
5 0
3 years ago
why might you want to use the send to compressed (zipped) folder command before sending four pictures to a friend via email
IceJOKER [234]

It's easier to send the files that way because you don't have to attach them individually, and then your friend won't have to download them individually - they can just download the zip package and have all four right at their disposal.

6 0
3 years ago
What is the very first tag you must enter into a new HTML Document?
podryga [215]

Answer:

<HTML> tag

Explanation:

The first tag in any HTML file is the <HTML> tag. This tells web browsers that the document is an HTML file

4 0
3 years ago
Read 2 more answers
Would you expect all the devices listed in bios setup to also be listed in device manager? would you expect all devices listed i
katen-ka-za [31]
<span>Would you expect all the devices listed in bios setup to also be listed in device manager? = Yes
Would you expect all devices listed in device manager to also be listed in bios setup? = No, the BIOS doesn't know anything about your peripherals etc. that is all managed by the OS.</span>
6 0
3 years ago
Other questions:
  • To create an individual version of a slide, you would click
    9·1 answer
  • ________ are devices in a computer that are in either the on or off state
    14·1 answer
  • Janice, who is 15, posts post a picture of herself drinking alcohol and making an obscene gesture on her social network page. wh
    15·2 answers
  • In a power point a type of chart that rather than showing numerical data illustrates a relationship or logical flow between diff
    12·1 answer
  • Which would increase electric current? increasing the resistance increasing the size of the wire decreasing the voltage
    6·1 answer
  • If the list above is named list1 and is implemented as a list, whatstatement would you use to find the number ofelements?list1.s
    9·1 answer
  • You decide to bulk upload your multiple business locations to Google My Business. Some of the locations in your upload were disa
    7·1 answer
  • Which of the following problems is least likely to be solved through grid computing? Financial risk modeling Gene analysis Linea
    14·1 answer
  • Focusing on a target market makes it harder to develop products and services that specific groups of customers want.
    10·1 answer
  • How does one build social capital?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!