I have the following HashMap data printing only the keySet(): -
[P001, P003, P005, P007, P004, P034, P093, P054, P006]
And the following ArrayList data as an output: -
[P001]
[P007]
[P034]
[P054]
This is how it is getting printed for both of them. I want to compare the array list data with the hash map data one by one. So, that the value [P001] should present inside HashMap.
Here is the part of code I have tried:-
def count = inputJSON.hotelCode.size() // Where "hotelCode" is particular node in inputJSON
Map<String,List> responseMap = new HashMap<String, List>()
for(int i=0; i<count; i++) {
Map jsonResult = (Map) inputJSON
List hotelC = jsonResult.get("hotelCode")
String id = hotelC[i].get("id")
responseMap.put(id, hotelC[i])
}
String hotelCFromInputSheet = P001#P007#P034#P054
String [] arr = roomProduct.split("#")
for(String a : arr) {
ArrayList <String> list = new ArrayList<String>()
list.addAll(a)
log.info list
log.info responseMap.keySet()
if(responseMap.keySet().contains(list)) {
log.info "Room Product present in the node"
}
}
Any help would be appreciated.