public SortedSet<Map.Entry<String,Counter>> getSortedSet(boolean byKey, int minCount) {
      Comparator<Map.Entry<String,Counter>> comp;
      if (byKey) {
         comp = new KeyComparator();
      }
      else {
         comp = new ValueComparator();
      }
   	  SortedSet<Map.Entry<String,Counter>> ss = new TreeSet<Map.Entry<String,Counter>>(comp);
   	  Iterator<Map.Entry<String,Counter>> iter = counts.entrySet().iterator();
   	  while (iter.hasNext()) {
   	  	Map.Entry<String,Counter> entry = iter.next();
   	  	if (entry.getValue().count >= minCount) {
   	  		ss.add(entry);
   	  	}
   	  }
   	  return ss;
   }