1 package net.sf.saxon.codenorm; 2 3 import java.util.HashMap ; 4 5 10 11 public class IntStringHashtable { 12 static final String copyright = "Copyright © 1998-1999 Unicode, Inc."; 13 14 public IntStringHashtable (String defaultValue, int initialSize) { 15 this.defaultValue = defaultValue; 16 table = new HashMap (initialSize); 17 } 18 19 public void put(int key, String value) { 20 if (value == defaultValue) { 21 table.remove(new Integer (key)); 22 } else { 23 table.put(new Integer (key), value); 24 } 25 } 26 27 public String get(int key) { 28 Object value = table.get(new Integer (key)); 29 if (value == null) return defaultValue; 30 return (String )value; 31 } 32 33 private String defaultValue; 34 private HashMap table; 35 } | Popular Tags |