Hashtable<Character, Integer>: Problemas com o método contains[Resolvido]

Olá pessoal!
Por favor, não entremos no mérito do porque que estou criando esta classe, ok? :lol: Eu tenho meus motivos, acreditem… :shock:
Minha dúvida é a seguinte: Em um certo momento do método digit, eu tenho um objeto do tipo Hashtable<Character, Integer> com o seguinte mapeamento:
‘0’ >>> 0
‘1’ >>> 1
Quando passo um parametro char valendo ‘0’, não consigo recuperar o respectivo valor…
Através do debug do eclipse eu verifiquei o mapeamento acima descrito, verifiquei que a chave é de fato do tipo Character, verfiquei que o hashCode do parâmetro (devidamente “wrappeado”) é igual ao hashCode da chave ‘0’ do Hashtable.
Gostaria de entender porque o método contains está retornando false

private static class DigitTable{
	private static final int
		MIN_RADIX = 2,
		MAX_RADIX = 36
	;
	
	private static int validateRadix(int radix) {
		return radix < MIN_RADIX ? -1 : radix > MAX_RADIX ? 1 : 0;
	}
	
	private static boolean radixUnderflow(int radix) {
		return validateRadix(radix) < 0;
	}
	
	private static boolean radixOverflow(int radix) {
		return validateRadix(radix) > 0;
	}
	
	private static boolean isValidRadix(int radix) {
		return validateRadix(radix) == 0;
	}
	
	private Hashtable<Integer, Hashtable<Character, Integer>> digits;
	
	DigitTable(){
		long l = System.currentTimeMillis();
		digits = new Hashtable<Integer, Hashtable<Character,Integer>>(
			MAX_RADIX - MIN_RADIX + 1
		);
		for(int radix = MIN_RADIX; radix <= MAX_RADIX; radix++) {
			Hashtable<Character,Integer> values =
				new Hashtable<Character, Integer>(radix);
			for(int i = 0, t = 'a', T = 'A'; i < radix; i++){
				if(i < 10)
					values.put(("" + i).charAt(0), i);
				else{
					values.put((char)t++, i);
					values.put((char)T++, i);
				}
			}
			digits.put(radix, values);
		}
		TimeCounter tc = new TimeCounter(System.currentTimeMillis() - l);
//    		System.out.println("\n\n\n" + tc.toSimpleString() + "\n\n");
	}
	
	public int digit(char c, int radix) {
		int result = -1;
		
		if(!isValidRadix(radix))
			return result;
		
		Hashtable<Character,Integer> values = digits.get(radix);
		if(values.contains(Character.valueOf(c)))
			result = values.get(c);
		
		return result;
	}
	
    public static void main(String[] args) {
		DigitTable dt = new DigitTable();
		System.out.println(dt.digit('0', 2));
	}
}

Obrigado!

Mas que diabos!!! Por que raios funciona se trocar Hashtable por TreeMap???

Troque o contains por containsKey.

[quote=javadoc]contains(Object value)
Tests if some key maps into the specified value in this hashtable.[/quote]

Agora porque funciona com TreeMap… aí nem testei isso hehehee

[edit]Ah, eu declarei assim

private Map<Integer, Map<Character, Integer>> digits;

Mas no new usa Hashtable mesmo :slight_smile:

Putz! pode crê!!! o contains vai verificar se há um valor igual ao passado por parâmetro… nossa, que lapso fenomenal o meu… aff… preciso dormir… preciso de férias…
A propósito, quando eu troquei por TreeMap, eu tive que trocar o contains pra containsKey, por que TreeMap só esse e containsValue… Olha só o meu vacilo!!! tsc. tsc. tsc…
Valeu dudaskank!