I have a class called Player (with a lot of things on it).
And also, i have a ArrayList of Players with 20 players: List<Player> Players = new ArrayList<Player>();
for example, i want to exchange the player on the position 2 of the array with the player in the position 15 of the array.
Can someone give me the code to do this please? i don't know and i can't find the way on the documentation/google
thanks
Try Collections.swap:
Collections.swap(Players, 2, 15);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With