Skip to content
Advertisement

Reverse subset of ArrayList using multidimensional ArrayList in Java

I am trying to reverse a sublist in a List using the indices provided in a multidimensional List. I don’t have much experience using multidimensional lists/arrays. I don’t understand why this doesn’t work.

JavaScript

The output of this code using [[0,1], [1, 3]] as the indecies is:

JavaScript

but it should be:

JavaScript

Can someone please help point me in the right direction?

Advertisement

Answer

This can be done as simple as this.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement