To convert the data list into a map, you can use the following code:

List<String> data = Org.getResult().getData();
Map<Integer, String> map = new HashMap<>();

for (int i = 0; i < data.size(); i++) {
    map.put(i, data.get(i));
}

In this code, a HashMap is created to store the data from the list. The index of each element in the list is used as the key in the map, and the corresponding element is stored as the value.

ListString data = OrggetResultgetData;data 转map

原文地址: https://www.cveoy.top/t/topic/hy8L 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录