Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package il.ac.tau.cs.sw1.ex8.wordsRank;
- import java.util.Comparator;
- import il.ac.tau.cs.sw1.ex8.wordsRank.RankedWord.rankType;
- /**************************************
- * Add your code to this class !!! *
- **************************************/
- class RankedWordComparator implements Comparator<RankedWord> {
- private rankType type;
- public RankedWordComparator(rankType cType) {
- this.type = cType;
- }
- @Override
- public int compare(RankedWord o1, RankedWord o2) {
- return o1.getRankByType(type) - o2.getRankByType(type);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement