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
HELP FAST PLEASE!!! What is a glass tube containing electrodes used as a switch to produce on or off signals for the computer? F
Mekhanik [1.2K]

Answer:

The answer is... Vaccum Tubes...

This is one which was used in computers before the Phenomenal invention of Transisitors.

3 0
3 years ago
What is an icon or animation used to represent aparticipant in an internet chat referred to as?
Veronika [31]
Emoji is an icon or animation used to represent a participant in an internet chat.
8 0
3 years ago
Which domain of an IT infrastructure primarily includes the processes and procedures that end users use to remotely access an or
Natalka [10]

Answer:

The answer is "Remote Domain Access".

Explanation:

It is also known as web access, it is an opportunity to moderately access a desktop or network over a connection to the internet. It also allows you to download the structures, that want even if they are not mentally and emotionally able to communicate specifically.

  • In other words, it uses a satellite for interaction or internet service, and users can access systems remotely.
  • It is also used in the database, that's why it is the correct answer.
6 0
3 years ago
Mac os is based on the ____ operating system.
ankoles [38]
Mac os is based on the UNIX operating system.
4 0
3 years ago
Which is an appropriate strategy for using a workplace blog?
OLEGan [10]

Answer:

a

Explanation:

8 0
3 years ago
Other questions:
  • Customers access the internet through what usually for a monthly fee
    14·1 answer
  • What is the relationship between a method and a function
    11·2 answers
  • After this week im gonna be moderator who ever needs help let me know
    5·1 answer
  • What is the radix transformation method?
    5·1 answer
  • Interactive sites where users write about personal topic and comment to threaded discussion are called?
    10·2 answers
  • Write a function that asks a user for his/her name and movie
    7·1 answer
  • Write only in C, not C++.
    14·1 answer
  • Define the missing function. licenseNum is created as: (100000 * customID) licenseYear, where customID is a function parameter.
    12·1 answer
  • Add the following method to the Point class: public double distance(Point other) Returns the distance between the current Point
    12·1 answer
  • A user calls to complain that her computer is behaving erratically. Some days it functions correctly, and other days, it crashes
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!