Reply to topic  [ 2 posts ] 
Java ArrayList swap 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
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.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Fri Nov 12, 2010 8:57 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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...


Fri Nov 12, 2010 11:30 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.