private static Map < String , String > mergeMapsAndRemoveEmptyStrings ( Map < String , String > overrideMap , Map < String , String > originalMap ) { Map < String , String > answer = MapUtil . mergeMaps ( overrideMap , originalMap ) ; Set < Map . Entry < String , String > > entries = overrideMap . entrySet ( ) ; for ( Map . Entry < String , String > entry : entries ) { String value = entry . getValue ( ) ; if ( value == null || value . isEmpty ( ) ) { String key = entry . getKey ( ) ; answer . remove ( key ) ; } } return answer ; }
Returns a merge of the given maps and then removes any resulting empty string values ( which is the way to remove say a label or annotation when overriding