title: finding strings with valid {}()[]
body: <p>How can I fix my code so that it can find the valid (){}[]? For now, it just returns true.</p>
  
  <pre><code>public static boolean isValid(String s){
  
          HashMap&lt;Character, Character&gt; specialChar= new HashMap&lt;&gt;();
          specialChar.put('{', '}');
          specialChar.put('[',']');
          specialChar.put('(',')');
          Stack&lt;Character&gt; stk = new Stack&lt;&gt;();
          for (int i=0; i&lt;s.length(); i++){
  
              if (specialChar.keySet().contains(s.charAt(i))){
                  stk.push(s.charAt(i));
              }
              else if (specialChar.values().contains(s.charAt(i))){
                  if (!stk.empty()) {
                      stk.pop();
                  }
              }
  
          }
  
          return stk.isEmpty();
  
      }
  
  
   System.out.println(isValid("{}{lll}]"));
  </code></pre>