Created
April 16, 2014 03:54
-
-
Save maxdemarzi/10804794 to your computer and use it in GitHub Desktop.
Mutable Int
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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