android/guava/src/com/google/common/collect/Collections2.java
private static boolean isPermutation(List<?> first, List<?> second) {
    if (first.size() != second.size()) {
      return false;
    }
    ObjectCountHashMap<?> firstCounts = counts(first);
    ObjectCountHashMap<?> secondCounts = counts(second);
    if (first.size() != second.size()) {
      return false;
    }
    for (int i = 0; i < first.size(); i++) {
      if (firstCounts.getValue(i) != secondCounts.get(firstCounts.getKey(i))) {
        return false;
      }
    }
    return true;
  }
private static boolean isPermutation(List<?> first, List<?> second) {
    if (first.size() != second.size()) {
      return false;
    }
    ObjectCountHashMap<?> firstCounts = counts(first);
    ObjectCountHashMap<?> secondCounts = counts(second);
    if (first.size() != second.size()) {
      return false;
    }
    for (int i = 0; i < first.size(); i++) {
      if (firstCounts.getValue(i) != secondCounts.get(firstCounts.getKey(i))) {
        return false;
      }
    }
    return true;
  }
Returns {@code true} if the second list is a permutation of the first.