SHARE
TWEET

Untitled

a guest May 25th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package il.ac.tau.cs.sw1.ex8.wordsRank;
  2.  
  3. import java.util.Comparator;
  4.  
  5. import il.ac.tau.cs.sw1.ex8.wordsRank.RankedWord.rankType;
  6.  
  7. /**************************************
  8.  * Add your code to this class !!! *
  9.  **************************************/
  10.  
  11. class RankedWordComparator implements Comparator<RankedWord> {
  12.  
  13.     private rankType type;
  14.  
  15.     public RankedWordComparator(rankType cType) {
  16.         this.type = cType;
  17.     }
  18.  
  19.     @Override
  20.     public int compare(RankedWord o1, RankedWord o2) { 
  21.  
  22.         return o1.getRankByType(type) - o2.getRankByType(type);
  23.  
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top