Skip to content

Instantly share code, notes, and snippets.

@chingovan
Last active March 2, 2017 01:51
Show Gist options
  • Save chingovan/a30103e834dd5cd9dc90af47c3644301 to your computer and use it in GitHub Desktop.
Save chingovan/a30103e834dd5cd9dc90af47c3644301 to your computer and use it in GitHub Desktop.
//SwapInt
public static void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
}
//SwapPoint
public static void swap(Point a, Point b) {
Point temp = a;
a = b;
b = temp;
}
//SwapPointRef
public static void swap(Point a, Point b) {
int temp = a.getX();
a.setX(b.getX());
b.setX(temp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment