x404.co.uk
http://www.x404.co.uk/forum/

Java ArrayList swap
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=11453
Page 1 of 1

Author:  Fogmeister [ Fri Nov 12, 2010 8:57 am ]
Post subject:  Java ArrayList swap

Hi All,

Is there any way of swapping 2 entries in an ArrayList without taking one out into a holder, moving the second and then putting the holder item back in?

i.e. I want to do ArrayList.swap(i,j).

At the end the objects in slot i and j would be in slot j and i resectively.

Author:  forquare1 [ Fri Nov 12, 2010 11:30 am ]
Post subject:  Re: Java ArrayList swap

Even if there was the overall process would remain the same meaning that performance wouldn't benefit.

Having a look I can't see anything in ArrayList or Vector...

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/