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; }  static LinkedHashMap<K, V> sortByValue(
      Map<K, V> map); static LinkedHashMap<K, V> sortByValueDescending(
      Map<K, V> map); static int getHammingDistance2Lists(List<? extends Object> list1,
      List<? extends Object> list2); static int getHammingDistance2DiffLists(List<? extends Object> list1,
      List<? extends Object> list2); static int getEditDistance2Lists(List<? extends Object> list1,
      List<? extends Object> list2); static double getJaroWinklerDistance2Lists(
      List<? extends Object> list1, List<? extends Object> list2,
      double scalingFactor);  }
@Test public void testGetJaroWinklerDistance2Lists() { List<Integer> list1 = new ArrayList<Integer>(); list1.add(1); list1.add(2); list1.add(3); List<Integer> list2 = new ArrayList<Integer>(); list2.add(1); list2.add(2); list2.add(3); List<Integer> list3 = new ArrayList<Integer>(); list3.add(2); list3.add(2); list3.add(3); List<Integer> list4 = new ArrayList<Integer>(); list4.add(2); list4.add(1); list4.add(3); List<Integer> list5 = new ArrayList<Integer>(); list5.add(2); list5.add(1); list5.add(2); Assert.assertTrue( CollectionsUtil.getJaroWinklerDistance2Lists(list1, list2, 0.1) == 0.0); Assert.assertTrue(CollectionsUtil.getJaroWinklerDistance2Lists(list1, list3, 0.1) == 0.22222222222222232); Assert.assertTrue(CollectionsUtil.getJaroWinklerDistance2Lists(list1, list4, 0.1) == 0.44444444444444453); Assert.assertTrue( CollectionsUtil.getJaroWinklerDistance2Lists(list1, list5, 0.1) == 1.0); }