I am having difficulties to compare the string (str) with the keys in hashmap. As you can see from the below code, I have multiple keys. I am comparing the str with the keys but I couldn't get the values for that specific key. Please note the map contains coin.
it works only if i directly input the string eg entry.getKey().getKeyOne().toString().contains("coin")
String str = "coin";
for(Map.Entry<Pair, String> entry : map.entrySet()) {
    if(entry.getKey().getKeyOne().toString().contains(str)||
        entry.getKey().getKeyTwo().toString().contains(str)) {
            entry.getValue();
    }
}
public class Pair {
    private String keyOne;
    private String keyTwo;
    Pair(String one,String two) {
        this.keyOne=one;
        this.keyTwo=two;
    }
    public String getKeyOne() {
        return keyOne;
    }
    public String getKeyTwo() {
       return keyTwo;
    }
}
 
     
     
     
    