title: How to properly iterate over two loops
body: <p>I want to replace my string into other string but without many signs. For example I have &quot;I want to be !#$%@!_&quot; and it should return &quot;Iwanttobe&quot;. And that works somehow, but unfortunately it iterates first loop(first character), then iterates over the entire second loop. And I would like it to iterate over all of the first and then all of the second and add characters to my new table based on that</p>
  <p>This is my method:</p>
  <pre><code>public static List&lt;Character&gt; count (String str){
  
      char[] chars = str.toCharArray();
      List&lt;Character&gt; charsWithOutSpecial = new ArrayList&lt;&gt;();
      char[] specialChars = {' ','!','&quot;','#','$','%','&amp;','(',')','*','+',',',
              '-','.','/',':',';','&lt;','=','&gt;','?','@','[',']','^','_',
              '`','{','|','}','~','\\','\''};
  
      for (int i = 0; i &lt; specialChars.length; i++) {
          for (int j = 0; j &lt; chars.length; j++) {
              if(specialChars[i] != chars[j]){
                  charsWithOutSpecial.add(chars[j]);
              }
          }
      }
      return charsWithOutSpecial;
  }
  </code></pre>