I have Hashmap (which basically has api response body). I'm trying to extract a particular value from it.
for(Entry<String, Object> i: response.entrySet()) {
System.out.println("Inside for loop "+i.getValue()); //1st Line
if(i.getValue().equals("A") ||i.getValue().equals("B")) {
System.out.println("Inside if true "); //Q) Why does it not go inside this if loop
}
}
If I debug, I get 'response' value (this is api response body) :
{content={id=12345, Status=A, onLine=true}}
The output for above for loop I'm getting as: (for 1st line only)
Inside for loop {id=12345, Status=A, onLine=true}
But how do I just get the value for Status?
Note- This is how the content of keys and values are
(id,"12345")
(Status,"A")
(onLine,true)
In some cases key Status can have different values like "A", "B", "C" etc. And this is why I would like to perform certain steps when the value for Status is either "A" or "B".
2nd Edit- Additionally I have also tried
response.containsValue("A")
But I'm not able to filter out the content.