code: public static void modifyOrInsertProfiles(File destination, Profile... profiles) {
          final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>();
          for (Profile profile : profiles) {
              modifications.put(profile.getProfileName(), profile);
          }
  
          modifyProfiles(destination, modifications);
      }
docs: Modify or insert new profiles into an existing credentials file by
  in-place modification. Only the properties of the affected profiles will
  be modified; all the unaffected profiles and comment lines will remain
  the same. This method does not support renaming a profile.
  
  @param destination
  The destination file to modify
  @param profiles
  All the credential profiles to be written.