code: private ImmutableList<ContentResult> filterPotentialMatches(List<ContentResult> candidates) {
      // Sort candidates such that those with the longest formatted strings come first.
      Collections.sort(candidates, new Comparator<ContentResult>() {
        @Override
        public int compare(ContentResult o1, ContentResult o2) {
          String o1Formatted = o1.getL10nFormatted();
          String o2Formatted = o2.getL10nFormatted();
          int o1Length = o1Formatted.length();
          int o2Length = o2Formatted.length();
          // Sort longest to shortest, then lexicographically.
          if (o1Length > o2Length) {
            return -1;
          } else if (o1Length == o2Length) {
            return o1Formatted.compareTo(o2Formatted);
          } else {
            return 1;
          }
        }
      });
      // Build the final result by filtering out ContentResult instances that with formatted strings that are contained by
      // the already selected instances' formatted strings.
      List<ContentResult> res = new ArrayList<>();
      for (ContentResult candidate : candidates) {
        boolean contained = false;
        for (ContentResult member : res) {
          if (member.getL10nFormatted().contains(candidate.getL10nFormatted())) {
            contained = true;
            break;
          }
        }
        if (!contained) {
          res.add(candidate);
        }
      }
      return ImmutableList.copyOf(res);
    }
docs: the real match is (2). (1) is just noise from another sentence.