code: public List<T> keySetSorted() {
          List<T> result = new ArrayList<>();
  
          PriorityQueue<Pair<T, Double>> pq = asPriorityQueue();
          while (!pq.isEmpty()) {
              result.add(pq.poll().getFirst());
          }
  
          return result;
      }
docs: This method returns List of elements, sorted by their counts
  @return