I currently have a Set that contains three strings ("car"
, "two dollar"
, "foo"
). I then execute the following against a passed HashMap<String, Double>
.
if (getSet().contains(currentHashMapItem.getKey()) == true) {
System.out.println(currentHashMapItem.getKey());
}
The first key is "car"
, that matches as expected and displays. However, the second key is "dollar"
, but doesn't display. Now my understanding of how contains works is it will return true if the string it is comparing exists in the Set that's being returned in getSet()
, but no dice. Even tried an ArrayList<String>
as well with no luck. Anyone ran into this before? Am I trying to cut too sharp a corner and forced to use a regex or iterator loop?