public static List < String > keys ( String prefix , Map < String , String > data ) { logger . debug ( "get keys for {}" , prefix ) ; // matches: 'prefix.xxx...' | 'prefix."xxx.t"...' Pattern keyPattern = Pattern . compile ( "^" + Pattern . quote ( prefix ) + "\\.(\"[^\"]+\"|[^\\.]+).*$" ) ; return data . keySet ( ) . stream ( ) . map ( key -> { Matcher m = keyPattern . matcher ( key ) ; return m . matches ( ) ? m . group ( 1 ) : null ; } ) . filter ( k -> k != null ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; }
Computes the available keys for the given prefix in this set of data .