code: public Set<String> getArbitraryPortletPreferenceNames(PortletDefinitionForm form) {
          // set default values for all portlet parameters
          PortletPublishingDefinition cpd =
                  this.portletPublishingDefinitionDao.getChannelPublishingDefinition(
                          form.getTypeId());
          Set<String> currentPrefs = new HashSet<>();
          currentPrefs.addAll(form.getPortletPreferences().keySet());
          for (Step step : cpd.getSteps()) {
              if (step.getPreferences() != null) {
                  for (Preference pref : step.getPreferences()) {
                      currentPrefs.remove(pref.getName());
                  }
              }
          }
          return currentPrefs;
      }
docs: Get a list of the key names of the currently-set arbitrary portlet preferences.
  
  @param form
  @return