subject

Consider the following method, remDups, which is intended to remove duplicate consecutive elements from nums, an ArrayList of integers. For example, if nums contains {1, 2, 2, 3, 4, 3, 5, 5, 6}, then after executing remDups(nums), nums should contain {1, 2, 3, 4, 3, 5, 6}. public static void remDups(ArrayList nums)
{
for (int j = 0; j < nums. size() - 1; j++)
{
if (nums. get(j).equals(nums. get(j + 1)))
{
nums. remove(j);
j++;
}
}
}
The code does not always work as intended. Which of the following lists can be passed to remDups to show that the method does NOT work as intended?
A. {1, 1, 2, 3, 3, 4, 5}
B. {1, 2, 2, 3, 3, 4, 5}
C. {1, 2, 2, 3, 4, 4, 5}
D. {1, 2, 2, 3, 4, 5, 5}
E. {1, 2, 3, 3, 4, 5, 5}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, babyface1686
How do you make a lenny face? plz, brailiest to who can answer first.
Answers: 1
image
Computers and Technology, 23.06.2019 06:00, ashleyd198308
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, summerjoiner
Verify each identity[tex] \frac{csc}{cot \: x \: + \: tan \: x} = cos \: x[/tex]
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, sameh0425
Which steps will open the system so that you can enter a question and do a search for
Answers: 1
You know the right answer?
Consider the following method, remDups, which is intended to remove duplicate consecutive elements f...

Questions in other subjects:

Konu
Mathematics, 31.10.2020 14:00
Konu
Mathematics, 31.10.2020 14:00
Konu
Health, 31.10.2020 14:00
Konu
Arts, 31.10.2020 14:00