Populating a HashMap with entries from a properties file

前端 未结 5 1197
南笙
南笙 2020-12-14 08:45

I want to populate a HashMap using the Properties class.
I want to load the entries in the .propeties file and then copy it into

5条回答
  •  一向
    一向 (楼主)
    2020-12-14 09:42

    Use .entrySet()

    for (Entry entry : properties.entrySet()) {
        map.put((String) entry.getKey(), (String) entry.getValue());
    }
    

提交回复
热议问题