class CollectionsUtil {

  public static double getJaroWinklerDistance2Lists(
      List<? extends Object> list1, List<? extends Object> list2,
      double scalingFactor) {
    if (list1 == null || list2 == null) {
      throw new IllegalArgumentException("Lists must not be null");
    }

    final int[] mtp = matches(list1, list2);
    final double m = mtp[0];
    if (m == 0) {
      return 1D;
    }
    final double j = ((m / list1.size() + m / list2.size() + (m - mtp[1]) / m))
        / 3;
    final double jw = j < 0.7D ? j
        : j + Math.min(scalingFactor, 1D / mtp[3]) * mtp[2] * (1D - j);
    return 1 - jw;
  }

}