java list swap 2 elements

Solutions on MaxInterview for java list swap 2 elements by the best coders in the world

showing results for - "java list swap 2 elements"
Trey
13 Nov 2020
1String a = words.get(0);
2words.set(0, words.get(words.size() - 1));
3words.set(words.size() - 1, a)
4