public static List<DeclarationWithProximity> getSortedProposedValues(
     Scope scope, Unit unit, final String exactName) {
   Map<String, DeclarationWithProximity> map = scope.getMatchingDeclarations(unit, "", 0, null);
   if (exactName != null) {
     for (DeclarationWithProximity dwp : new ArrayList<DeclarationWithProximity>(map.values())) {
       if (!dwp.isUnimported() && !dwp.isAlias() && isNameMatching(dwp.getName(), exactName)) {
         map.put(dwp.getName(), new DeclarationWithProximity(dwp.getDeclaration(), -5));
       }
     }
   }
   List<DeclarationWithProximity> results = new ArrayList<DeclarationWithProximity>(map.values());
   Collections.sort(results, new ArgumentProposalComparator(exactName));
   return results;
 }
 @Override
 public int compare(DeclarationWithProximity x, DeclarationWithProximity y) {
   String xname = x.getName();
   String yname = y.getName();
   if (exactName != null) {
     boolean xhit = xname.equals(exactName);
     boolean yhit = yname.equals(exactName);
     if (xhit && !yhit) {
       return -1;
     }
     if (yhit && !xhit) {
       return 1;
     }
     xhit = isNameMatching(xname, exactName);
     yhit = isNameMatching(yname, exactName);
     if (xhit && !yhit) {
       return -1;
     }
     if (yhit && !xhit) {
       return 1;
     }
   }
   Declaration xd = x.getDeclaration();
   Declaration yd = y.getDeclaration();
   boolean xdepr = xd.isDeprecated();
   boolean ydepr = yd.isDeprecated();
   if (xdepr && !ydepr) {
     return 1;
   }
   if (!xdepr && ydepr) {
     return -1;
   }
   int xp = x.getProximity();
   int yp = y.getProximity();
   int p = xp - yp;
   if (p != 0) {
     return p;
   }
   int c = xname.compareTo(yname);
   if (c != 0) {
     return c;
   }
   return xd.getQualifiedNameString().compareTo(yd.getQualifiedNameString());
 }