MCPcopy Create free account
hub / github.com/apna-college/Alpha / swap

Method swap

11_ArrayLists/Swap.java:3–7  ·  view source on GitHub ↗
(ArrayList<Integer> list, int idx1, int idx2)

Source from the content-addressed store, hash-verified

1import java.util.ArrayList;
2public class Swap {
3 public static void swap(ArrayList<Integer> list, int idx1, int idx2) {
4 int temp = list.get(idx1);
5 list.set(idx1, list.get(idx2));
6 list.set(idx2, temp);
7 }
8 public static void main(String args[]) {
9 ArrayList<Integer> list = new ArrayList<>();
10 list.add(2);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected