public @NotNull String getExpected(int position, boolean expected) {
      StringBuilder sb = new StringBuilder();
      MyList<Variant> list = expected ? variants : unexpected;
      String[] strings = new String[list.size()];
      long[] hashes = new long[strings.length];
      Arrays.fill(strings, "");
      int count = 0;
      loop: for (Variant variant : list) {
        if (position == variant.position) {
          String text = String.valueOf(variant.object);
          long hash = StringHash.calc(text);
          for (int i=0; i<count; i++) {
            if (hashes[i] == hash) continue loop;
          }
          hashes[count] = hash;
          strings[count] = text;
          count++;
        }
      }
      Arrays.sort(strings);
      count = 0;
      for (String s : strings) {
        if (s.isEmpty()) continue;
        if (count++ > 0) {
          if (count > MAX_VARIANTS_TO_DISPLAY) {
            sb.append(" ").append(AnalysisBundle.message("parsing.error.and.ellipsis"));
            break;
          }
          else {
            sb.append(", ");
          }
        }
        char c = s.charAt(0);
        String displayText = c == '<' || isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
        sb.append(displayText);
      }
      if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
        int idx = sb.lastIndexOf(", ");
        sb.replace(idx, idx + 1, " " + AnalysisBundle.message("parsing.error.or"));
      }
      return sb.toString();
    }
public @NotNull String getExpected(int position, boolean expected)