java list swap 2 elements code example
Example: java list swap 2 elements
String a = words.get(0);
words.set(0, words.get(words.size() - 1));
words.set(words.size() - 1, a)
String a = words.get(0);
words.set(0, words.get(words.size() - 1));
words.set(words.size() - 1, a)