class VulnerabilityService implements Constants {

	public List<Map<String, Object>> getCartesianProduct(List<Map<String, Object>> vulnerabilityOccuranceList,
			List<Map<String, Object>> resourceIdDetails) {
		List<Map<String, Object>> finalVulnerabilityOccuranceList = new ArrayList<Map<String, Object>>();
		LinkedHashMap<String, Map<String, Object>> mapOfResourceAttributeMap = new LinkedHashMap<String, Map<String, Object>>();
		for (Map<String, Object> resourceAttributeMap : resourceIdDetails) {
			mapOfResourceAttributeMap.put((String) resourceAttributeMap.get("_resourceid"), resourceAttributeMap);
		}

		/*
		 * mapOfResourceAttributeMap = resourceIdDetails.stream()
		 * .collect(Collectors.toMap(obj -> obj.get("_resourceid").toString(), obj ->
		 * obj));
		 */
		for (Map<String, Object> vulnerabilityOccuranceMap : vulnerabilityOccuranceList) {
			LinkedHashMap<String, Object> finalVulnerabilityOccuranceMap = new LinkedHashMap<>(
					vulnerabilityOccuranceMap);
			String resourceId = (String) vulnerabilityOccuranceMap.get("_resourceid");
			if (!mapOfResourceAttributeMap.containsKey(resourceId)) {
				continue;
			}

			finalVulnerabilityOccuranceMap.putAll(mapOfResourceAttributeMap.get(resourceId));
			finalVulnerabilityOccuranceList.add(finalVulnerabilityOccuranceMap);
		}

		return finalVulnerabilityOccuranceList;
	}

}