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