1 // 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html#License 3 package com.ibm.icu.dev.test.normalizer; 4 5 import java.util.HashMap; 6 import java.util.Map; 7 8 9 /** 10 ******************************************************************************* 11 * Copyright (C) 1998-2010, International Business Machines Corporation and * 12 * Unicode, Inc. All Rights Reserved. * 13 ******************************************************************************* 14 * 15 * Integer-String hash table. Uses Java Hashtable for now. 16 * @author Mark Davis 17 */ 18 19 public class IntStringHashtable { 20 21 public IntStringHashtable (String defaultValue) { 22 this.defaultValue = defaultValue; 23 } 24 25 public void put(int key, String value) { 26 if (value == defaultValue) { 27 table.remove(new Integer(key)); 28 } else { 29 table.put(new Integer(key), value); 30 } 31 } 32 33 public String get(int key) { 34 String value = table.get(new Integer(key)); 35 if (value == null) return defaultValue; 36 return value; 37 } 38 39 private String defaultValue; 40 private Map<Integer, String> table = new HashMap<Integer, String>(); 41 }