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