HashMaps and Null values?

前端 未结 2 1001
余生分开走
余生分开走 2021-02-11 12:07

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

HashMap options = new HashMap         


        
2条回答
  •  走了就别回头了
    2021-02-11 12:28

    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.

提交回复
热议问题