HashMaps and Null values?

前端 未结 4 1653
闹比i
闹比i 2021-02-11 11:50

How do you pass in null values into a HashMap?
The following code snippet works with options filled in:

HashMap options = new HashMap         


        
4条回答
  •  别跟我提以往
    2021-02-11 12:39

    HashMap supports both null keys and values

    http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html

    ... and permits null values and the null key

    So your problem is probably not the map itself.

提交回复
热议问题