question: public static String expandPrefix ( NavigableSet < String > names , String prefix ) { String name = prefix ; if ( ! names . contains ( name ) ) { final String closest = names . ceiling ( prefix ) ; if ( closest != null && closest . startsWith ( prefix ) ) { final String higher = names . higher ( closest ) ; if ( higher == null || ! higher . startsWith ( prefix ) ) { name = closest ; } } } return name ; }
target:  Expand a name if it is an unambiguous prefix of an entry in the given set of names