class ResourceProcessDefinitionUtils {

    public static Map<Integer, Set<Integer>> getResourceProcessDefinitionMap(List<Map<String, Object>> list) {
        Map<Integer, String> map = new HashMap<>();
        Map<Integer, Set<Integer>> result = new HashMap<>();
        if (CollectionUtils.isNotEmpty(list)) {
            for (Map<String, Object> tempMap : list) {

                map.put((Integer) tempMap.get("id"), (String)tempMap.get("resource_ids"));
            }
        }

        for (Map.Entry<Integer, String> entry : map.entrySet()) {
            Integer mapKey = entry.getKey();
            String[] arr = entry.getValue().split(",");
            Set<Integer> mapValues = Arrays.stream(arr).map(Integer::parseInt).collect(Collectors.toSet());
            for (Integer value : mapValues) {
                if (result.containsKey(value)) {
                    Set<Integer> set = result.get(value);
                    set.add(mapKey);
                    result.put(value, set);
                } else {
                    Set<Integer> set = new HashSet<>();
                    set.add(mapKey);
                    result.put(value, set);
                }
            }
        }
        return result;
    }

}