Levenshtein { public static <T extends CharSequence> T findMinimum(Collection<T> ss, CharSequence t) { int min = Integer.MAX_VALUE; T result = null; for (T s : ss) { int d = LevenshteinDistance.getDefaultInstance().apply(s, t); if (d < min) { min = d; result = s; } } return result; }  static T findMinimum(Collection<T> ss,
            CharSequence t); static Collection<T> findMinimum(
            Collection<T> ss, CharSequence t, int n, int threshold); static Collection<T> findSimilar(
            Collection<T> ss, CharSequence t);  }
@Test public void findMinimum() { List<String> ss = Arrays.asList("Holla", "World", "Hello", "Hippo", "Hiplo"); CharSequence min = Levenshtein.findMinimum(ss, "Hillo"); assertEquals("Hello", min); }
@Test public void findThreeMinumums() { List<String> ss = Arrays.asList("Holla", "World", "Hello", "Hippo", "Hiplo"); Collection<String> min = Levenshtein.findMinimum(ss, "Hillo", 3, 5); assertEquals(Arrays.asList("Hello", "Hiplo", "Holla"), min); }
@Test public void findMinumumsThreshold() { List<String> ss = Arrays.asList("Holla", "World", "Hello", "Hippo", "Hiplo"); Collection<String> min = Levenshtein.findMinimum(ss, "Hillo", 5, 2); assertEquals(Arrays.asList("Hello", "Hiplo"), min); }