public static String getDidYouMeanMessage ( Iterable < String > allNames , String wrongName ) { String closestName = getClosest ( allNames , wrongName ) ; if ( closestName != null ) { return String . format ( " Did you mean '%s'?" , closestName ) ; } return "" ; }
Given a collection of strings and a name that isn t contained in it . Return a message that suggests one of the names .