private static String compareFileLists(List<String> expected, List<String> gotten) {
    StringBuilder sb = new StringBuilder(
      "Expected (" + expected.size() + "): \t\t Gotten (" + gotten.size() + "):\n");
    List<String> notFound = new ArrayList<>();
    for (String s : expected) {
      if (gotten.contains(s)) sb.append(s + "\t\t" + s + "\n");
      else notFound.add(s);
    }
    sb.append("Not Found:\n");
    for (String s : notFound) {
      sb.append(s + "\n");
    }
    sb.append("\nExtra:\n");
    for (String s : gotten) {
      if (!expected.contains(s)) sb.append(s + "\n");
    }
    return sb.toString();
  }
Returns &lt;expected, gotten, backup&gt;, where each is sorted
hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java