BigDecimal endValue1 = xxxx;
HashMap<String, Object> endValue = 
如何将endValue1的值赋值给HashMap的endValue?

解决方案 »

  1.   

    不是很清楚你的意思,怎么算 “endValue1的值赋值给HashMap的endValue”?
    这本来就是两个类型,可以让endValue1作为endValue的一个值
    BigDecimal endValue1 = xxxx;
    HashMap<String, Object> endValue =new HashMap<String, Object>();
    endValue.put("value1", endValue1);
      

  2.   

    下面是个demoimport java.math.BigDecimal;
    import java.util.HashMap;public class BigDecimalDemo1 { /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    BigDecimal endValue1 = new BigDecimal("15.3");
            HashMap<String, Object> endValue =new HashMap<String, Object>();
            endValue.put("value1", endValue1);
            
            System.out.println(endValue.get("value1"));
    }}
      

  3.   

    不同的两个类型怎么能相互赋值?
    Map是集合,应该是把BigDecimal保存到集合中
    代码如2L