private Map < String , String > getCustomMap ( Pattern keyPattern ) { Map < String , String > map = new HashMap <> ( ) ; for ( Iterator < Object > it = props . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String key = ( String ) it . next ( ) ; Matcher matcher = keyPattern . matcher ( key ) ; if ( matcher . matches ( ) ) { String id = matcher . group ( 2 ) ; String propertyValue = props . getProperty ( key ) ; map . put ( id , propertyValue ) ; } } return map ; }
Returns the map where the key is the 2 group of the pattern and the value is the property value