public static Map < MetaKey , String > union ( final Map < MetaKey , String > providedMetaData , final Map < MetaKey , String > extractedMetaData ) { final int size1 = providedMetaData != null ? providedMetaData . size ( ) : 0 ; final int size2 = extractedMetaData != null ? extractedMetaData . size ( ) : 0 ; if ( size1 + size2 == 0 ) { return Collections . emptyMap ( ) ; } final Map < MetaKey , String > result = new HashMap <> ( size1 + size2 ) ; if ( extractedMetaData != null ) { result . putAll ( extractedMetaData ) ; } // provided will override if ( providedMetaData != null ) { result . putAll ( providedMetaData ) ; } return Collections . unmodifiableMap ( result ) ; }
Return an unmodifiable map of provided and extracted meta data