Collection swap

I have a basic question in collection. I know there is a swap function in Collections, but is there one for Collection ?Collection coll1 contains "b", "a" and "c" in that order. I want to swap "a" and "b".
[226 byte] By [dependOnJavaa] at [2007-11-27 8:11:26]
# 1
Why can't you use the one in Collections?
hunter9000a at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 2
Just use the Collections.swap method to swap two elements in you Collection.Collections.swap( yourlist, itema, itemb );
bryanoa at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 3
googleswap.avi
mkoryaka at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 4
> google> swap.avinooooooooooooooooooooooooooooooooooooooooooooooooo
hunter9000a at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 5
agreed....
bryanoa at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 6
Thanks for your reply, but I cannot use collections, since I am getting this Collection object through an API. Is there a simple way to swap ? Or do I need to search for the object, note the index and swap that way ?
dependOnJavaa at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 7
I don't quite understand why you couldn't use the Collections class, but none the less, if you cannot, then yes, I would do a simple swap by getting the two indexes of the items to swap and then manually swap them.
bryanoa at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 8
Thanks , Bryano and Hunter ! I understand now what you guys were saying ! points coming ur way.
dependOnJavaa at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 9
what about me?have you seen swap.avi?
mkoryaka at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...
# 10
> what about me?> have you seen swap.avi?nooooooooooooooooooooooooooooooooooooooooooooo
hunter9000a at 2007-7-12 19:55:24 > top of Java-index,Java Essentials,New To Java...