Skip to content

Instantly share code, notes, and snippets.

@maxdemarzi
Created April 16, 2014 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxdemarzi/10804794 to your computer and use it in GitHub Desktop.
Save maxdemarzi/10804794 to your computer and use it in GitHub Desktop.
Mutable Int
/**
* Private inner class for sorting.
*
* @author dany
*/
public final class MutableInt implements Comparable<MutableInt> {
public int value = 0;
public MutableInt(int value) {
this.value = value;
}
/**
* inc value
*/
public void increment() {
++value;
}
@Override
public int compareTo(MutableInt o) {
return value - o.value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment