Strings { public static String getMostSimilarWord(String word, Collection<String> similarWords) { int minLevenstein = Integer.MAX_VALUE; String mostSimilarWord = null; for ( String similarWord : similarWords ) { int levensteinDistance = levenshteinDistance( similarWord, word ); if ( levensteinDistance < minLevenstein ) { minLevenstein = levensteinDistance; mostSimilarWord = similarWord; } } return mostSimilarWord; } private  Strings(); static String capitalize(String string); static String decapitalize(String string); static String join(Iterable<?> iterable, String separator); static String join(Iterable<T> iterable, String separator, Extractor<T, String> extractor); static String joinAndCamelize(Iterable<?> iterable); static boolean isEmpty(String string); static boolean isNotEmpty(String string); static String getSafeVariableName(String name, String... existingVariableNames); static String getSafeVariableName(String name, Collection<String> existingVariableNames); static String sanitizeIdentifierName(String identifier); static String stubPropertyName(String fullyQualifiedName); static String getMostSimilarWord(String word, Collection<String> similarWords);  }
@Test public void findMostSimilarWord() { String mostSimilarWord = Strings.getMostSimilarWord( "fulName", Arrays.asList( "fullAge", "fullName", "address", "status" ) ); assertThat( mostSimilarWord ).isEqualTo( "fullName" ); }