Code example for Hashtable

Methods: containsKey, get

0
package upenn.junto.util; 
 
import java.util.Hashtable; 
 
public class Defaults { 
	 
  public static String GetValueOrDie(Hashtable config, String key) {
    if (!config.containsKey(key)) {
      MessagePrinter.PrintAndDie("Must specify " + key + "");
    } 
    return ((String) config.get(key));
  } 
 
  public static String GetValueOrDefault(String valStr, String defaultVal) {
    String res = defaultVal;
    if (valStr != null) {
      res = valStr;
    } 
    return (res);
  } 
 
  public static double GetValueOrDefault(String valStr, double defaultVal) {
    double res = defaultVal;