[Solved] Hash Map with key Values – How to get the value using bigdecimal key? [closed]


If I can guess what you might be doing, I came up with this and it is working. Please have a look:

import java.math.BigDecimal;
import java.util.*;
public class MyTest {
    public static void main(String[] args) {
        BigDecimal myBigDecimal = new BigDecimal(11);
        Map<Integer, String> myMap = new HashMap<Integer, String>();
        myMap.put(new Integer(11), "Hello World!");
        String message = (String) myMap.get(myBigDecimal.intValue());
        System.out.println(message);
    }
}

OUTPUT:

C:\Mine\JAVA\J2SE\classes>java MyTest
Hello World!

1

solved Hash Map with key Values – How to get the value using bigdecimal key? [closed]