List<Map<String,List<String>>> maplist = SessionHelper.getUserTableAuthData();
//所有权限表
List<String> IndicatorcategoryIDs = new ArrayList<>();
//所有权限表-权限字段数组
HashMap<String, List<String>> IndicatorIDshashMap = new HashMap<>();
for (Map<String, List<String>> item : maplist) {
Iterator<Map.Entry<String, List<String>>> iter = item.entrySet().iterator();// 该方法获取列名.获取一系列字段名称.例如name,age...
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();// 把hashmap转成Iterator再迭代到entry
String key = "";
if (entry.getKey() != null)
key = entry.getKey().toString(); // 从iterator遍历获取key
IndicatorcategoryIDs.add(key);
List<String> value = new ArrayList<>();
if (entry.getValue() != null)
value = (List<String>)entry.getValue(); // 从hashmap遍历获取value
IndicatorIDshashMap.put(key, value);
}
}
更多内容请访问:IT源点
注意:本文归作者所有,未经作者允许,不得转载