Skip to content

Instantly share code, notes, and snippets.

@linnykoleh
Created May 3, 2017 13:31
Show Gist options
  • Save linnykoleh/ca668c1d0febfc8ec99009decd130bca to your computer and use it in GitHub Desktop.
Save linnykoleh/ca668c1d0febfc8ec99009decd130bca to your computer and use it in GitHub Desktop.
public class Key implements Comparable<Key>{
private static int MORE = 1;
private static int LESS = -1;
private static int SAME = 0;
private int index;
public Key(int index) {
this.index = index;
}
public int getIndex() {
return index;
}
@Override
public int compareTo(Key o) {
if(index > o.index){
return MORE;
}else if(index < o.index){
return LESS;
} else {
return SAME;
}
}
@Override
public String toString() {
return index+"";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment