public static boolean update(Map<String,Object> source,Map<String,Object> changes,boolean checkUpdatesAreUnequal){
  boolean modified=false;
  for (  Map.Entry<String,Object> changesEntry : changes.entrySet()) {
    if (!source.containsKey(changesEntry.getKey())) {
      source.put(changesEntry.getKey(),changesEntry.getValue());
      modified=true;
      continue;
    }
    Object old=source.get(changesEntry.getKey());
    if (old instanceof Map && changesEntry.getValue() instanceof Map) {
      modified|=update((Map<String,Object>)source.get(changesEntry.getKey()),(Map<String,Object>)changesEntry.getValue(),checkUpdatesAreUnequal && !modified);
      continue;
    }
    source.put(changesEntry.getKey(),changesEntry.getValue());
    if (modified) {
      continue;
    }
    if (!checkUpdatesAreUnequal) {
      modified=true;
      continue;
    }
    modified=!Objects.equals(old,changesEntry.getValue());
  }
  return modified;
}

public static boolean update ( Map < String , Object > source , Map < String , Object > changes , boolean checkUpdatesAreUnequal ) { boolean modified = false ; for ( Map . Entry < String , Object > changesEntry : changes . entrySet ( ) ) { if ( ! source . containsKey ( changesEntry . getKey ( ) ) ) { source . put ( changesEntry . getKey ( ) , changesEntry . getValue ( ) ) ; modified = true ; continue ; } Object old = source . get ( changesEntry . getKey ( ) ) ; if ( old instanceof Map && changesEntry . getValue ( ) instanceof Map ) { modified |= update ( ( Map < String , Object > ) source . get ( changesEntry . getKey ( ) ) , ( Map < String , Object > ) changesEntry . getValue ( ) , checkUpdatesAreUnequal && ! modified ) ; continue ; } source . put ( changesEntry . getKey ( ) , changesEntry . getValue ( ) ) ; if ( modified ) { continue ; } if ( ! checkUpdatesAreUnequal ) { modified = true ; continue ; } modified = ! Objects . equals ( old , changesEntry . getValue ( ) ) ; } return modified ; }
updates the provided changes into the source . if the key exists in the changes , it overrides the one in source unless both are maps , in which case it recuersively updated it .
