private Parameters(){
  for (Iterator i=arguments.iterator(); i.hasNext(); ) {
    String arg=(String)i.next();
    arg=arg.toLowerCase();
    if (!arg.startsWith("-"))     throw new IllegalArgumentException("Command-line argument does not start with '-': " + arg);
    int colonIndex=arg.indexOf(":");
    String key;
    String value;
    if (colonIndex >= 0) {
      key=arg.substring(1,colonIndex);
      value=arg.substring(colonIndex + 1);
    }
 else {
      key=arg.substring(1);
      value="";
    }
    if (!allowedKeys.contains(key))     throw new IllegalArgumentException("Unrecognized command-line argument: " + arg.substring(1) + ". Valid arguments are: "+ StringUtil.toCommaDelimitedString(allowedKeys));
    hashtable.put(key,value);
  }
  for (Iterator i=requiredKeys.iterator(); i.hasNext(); ) {
    String requiredKey=(String)i.next();
    if (!hashtable.containsKey(requiredKey))     throw new IllegalArgumentException("Required command-line argument is missing: " + requiredKey);
  }
}

private Parameters ( ) { for ( Iterator i = arguments . iterator ( ) ; i . hasNext ( ) ; ) { String arg = ( String ) i . next ( ) ; arg = arg . toLowerCase ( ) ; if ( ! arg . startsWith ( "-" ) ) throw new IllegalArgumentException ( "Command-line argument does not start with '-': " + arg ) ; int colonIndex = arg . indexOf ( ":" ) ; String key ; String value ; if ( colonIndex >= 0 ) { key = arg . substring ( 1 , colonIndex ) ; value = arg . substring ( colonIndex + 1 ) ; } else { key = arg . substring ( 1 ) ; value = "" ; } if ( ! allowedKeys . contains ( key ) ) throw new IllegalArgumentException ( "Unrecognized command-line argument: " + arg . substring ( 1 ) + ". Valid arguments are: " + StringUtil . toCommaDelimitedString ( allowedKeys ) ) ; hashtable . put ( key , value ) ; } for ( Iterator i = requiredKeys . iterator ( ) ; i . hasNext ( ) ; ) { String requiredKey = ( String ) i . next ( ) ; if ( ! hashtable . containsKey ( requiredKey ) ) throw new IllegalArgumentException ( "Required command-line argument is missing: " + requiredKey ) ; } }
creates a parameters object for the given main - method arguments .
