private void getCommandsToDiff ( String mapName , CatalogMap < ? extends CatalogType > prevMap , CatalogMap < ? extends CatalogType > newMap ) { assert ( prevMap != null ) ; assert ( newMap != null ) ; // in previous, not in new for ( CatalogType prevType : prevMap ) { String name = prevType . getTypeName ( ) ; CatalogType newType = newMap . get ( name ) ; if ( newType == null ) { writeDeletion ( prevType , newMap . m_parent , mapName ) ; continue ; } diffRecursively ( prevType , newType ) ; } // in new, not in previous for ( CatalogType newType : newMap ) { CatalogType prevType = prevMap . get ( newType . getTypeName ( ) ) ; if ( prevType != null ) continue ; writeAddition ( newType ) ; } }
Check if all the children in prevMap are present and identical in newMap . Then check if anything is in newMap that isn t in prevMap .