Created
May 3, 2017 13:31
-
-
Save linnykoleh/ca668c1d0febfc8ec99009decd130bca to your computer and use it in GitHub Desktop.
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
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