@Override public void test() throws ParameterException {
  ArrayList<String> set=new ArrayList<>();
  ArrayList<String> notSet=new ArrayList<>();
  for (  Parameter<?> p : parameterList) {
    if (p.isDefined()) {
      set.add(p.getName());
    }
 else {
      notSet.add(p.getName());
    }
  }
  if (!set.isEmpty() && !notSet.isEmpty()) {
    throw new WrongParameterValueException("Global Constraint Error.\n" + "Either all of the parameters " + OptionUtil.optionsNamesToString(parameterList) + " must be set or none of them. "+ "Parameter(s) currently set: "+ set.toString()+ ", parameters currently "+ "not set: "+ notSet.toString());
  }
}

@ Override public void test ( ) throws ParameterException { ArrayList < String > set = new ArrayList < > ( ) ; ArrayList < String > notSet = new ArrayList < > ( ) ; for ( Parameter < ? > p : parameterList ) { if ( p . isDefined ( ) ) { set . add ( p . getName ( ) ) ; } else { notSet . add ( p . getName ( ) ) ; } } if ( ! set . isEmpty ( ) && ! notSet . isEmpty ( ) ) { throw new WrongParameterValueException ( "Global Constraint Error.\n" + "Either all of the parameters " + OptionUtil . optionsNamesToString ( parameterList ) + " must be set or none of them. " + "Parameter(s) currently set: " + set . toString ( ) + ", parameters currently " + "not set: " + notSet . toString ( ) ) ; } }
checks if either all elements of a list of parameters are set , or none of them . if not , a parameter exception is thrown .
