Two "hash" classes, ``++Hashtable++``, and ``++ConcurrentHashMap++`` offer ``++contains++`` methods. One might naively assume that the ``++contains++`` method searches both keys and values for its argument. And one would be wrong. Because these legacy methods search only values, they are likely to mislead maintainers even if the original coder understood precisely what's going on. == Noncompliant Code Example ---- Hashtable ht = new Hashtable<>(); // ... if (ht.contains(foo)) { // Noncompliant // ... } ---- == Compliant Solution ---- Hashtable ht = new Hashtable<>(); // ... if (ht.containsValue(foo)) { // ... } ----