]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-52_1/main/tests/core/src/com/ibm/icu/dev/test/normalizer/IntHashtable.java
Clean up imports.
[Dictionary.git] / jars / icu4j-52_1 / main / tests / core / src / com / ibm / icu / dev / test / normalizer / IntHashtable.java
1 package com.ibm.icu.dev.test.normalizer;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6
7 /**
8  *******************************************************************************
9  * Copyright (C) 1998-2010, International Business Machines Corporation and    *
10  * Unicode, Inc. All Rights Reserved.                                          *
11  *******************************************************************************
12  *
13  * Integer hash table.
14  * @author Mark Davis
15  */
16  
17 public class IntHashtable {
18
19     public IntHashtable (int defaultValue) {
20         this.defaultValue = defaultValue;
21     }
22
23     public void put(int key, int value) {
24         if (value == defaultValue) {
25             table.remove(new Integer(key));
26         } else {
27             table.put(new Integer(key), new Integer(value));
28         }
29     }
30
31     public int get(int key) {
32         Integer value = table.get(new Integer(key));
33         if (value == null) return defaultValue;
34         return value.intValue();
35     }
36
37     private int defaultValue;
38     private Map<Integer, Integer> table = new HashMap<Integer, Integer>();
39 }