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