Cannot find associated value in a hashmap from a passed in key
<p>I am working with some existing code in my Eclipse project.  In the method below called <code>cardTypeForPbfValue()</code>, I cannot find the key in the <code>HashMap</code> even though I can see it while debugging my the code.  The <code>pbfValueMap</code> is populated as follows:</p>

<pre><code>[1=ATM, 2=DEBIT, 3=CREDIT, 4=PAYROLL]
</code></pre>

<p>I'm not sure why I cannot get the associated value of <code>CREDIT</code> when I'm passing in a value of 3 in the <code>cardTypeForPbfValue()</code> below. I am actually getting a value of <code>NULL</code>.  </p>

<p>Any help/direction would be appreciated.</p>

<p>Here is the code I'm working with:</p>

<pre><code>public static enum CardType {
    CREDIT(3),
    ATM(1),
    DEBIT(2),
    PAYROLL(4);
    CardType(int pbfValue) {
        this.pbfValue = (short) pbfValue;
    }

    public static HashMap&lt;Short, CardType&gt;  pbfValueMap = new HashMap&lt;Short, CardType&gt;();
    static {
        for (CardType cardType : CardType.values()) {
            short value = cardType.pbfValue;
            pbfValueMap.put(cardType.pbfValue, cardType);
        }
    }

    public static CardType **cardTypeForPbfValue**(int pbfValue) {
        CardType returnValue = pbfValueMap.get(pbfValue);
        if (returnValue == null) {
            returnValue = DEBIT;
        }
        return returnValue;
    }

    public short    pbfValue;
}
</code></pre>
