summaryrefslogtreecommitdiff
path: root/android_icu4j/src/main/tests/android/icu/dev/test/normalizer/IntHashtable.java
blob: 5c26a4c90adecaad4a0c0ad0f83da6a0e6dfabb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* GENERATED SOURCE. DO NOT MODIFY. */
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
package android.icu.dev.test.normalizer;

import java.util.HashMap;
import java.util.Map;
import android.icu.testsharding.MainTestShard;


/**
 *******************************************************************************
 * Copyright (C) 1998-2010, International Business Machines Corporation and    *
 * Unicode, Inc. All Rights Reserved.                                          *
 *******************************************************************************
 *
 * Integer hash table.
 * @author Mark Davis
 */
 
@MainTestShard
public class IntHashtable {

    public IntHashtable (int defaultValue) {
        this.defaultValue = defaultValue;
    }

    public void put(int key, int value) {
        if (value == defaultValue) {
            table.remove(new Integer(key));
        } else {
            table.put(new Integer(key), new Integer(value));
        }
    }

    public int get(int key) {
        Integer value = table.get(new Integer(key));
        if (value == null) return defaultValue;
        return value.intValue();
    }

    private int defaultValue;
    private Map<Integer, Integer> table = new HashMap<Integer, Integer>();
}