How to get a immutable collection from java HashMap?

前端 未结 5 668
一个人的身影
一个人的身影 2020-12-19 02:44

I need to get a collection from the java HashMap without the changes in the map reflecting in the collection later . I wanted to use Collection.toArray() to achieve this , b

5条回答
  •  执笔经年
    2020-12-19 03:12

    Google collections Immutable Map may help you.

    see Collections.unmodifiableMap also

提交回复
热议问题