public static Map < String , String > getVariableMapByPrefix ( final Collection < Variable > variables , final String prefix ) { final Map < String , String > shortlistMap = new HashMap <> ( ) ; if ( variables != null && prefix != null ) { for ( final Variable var : getVariablesByRegex ( variables , Reportal . REPORTAL_CONFIG_PREFIX_REGEX ) ) { shortlistMap . put ( var . getTitle ( ) . replaceFirst ( prefix , "" ) , var . getName ( ) ) ; } } return shortlistMap ; }
Shortlist variables which match a given prefix . Returns empty map if no eligible variable is found .