title: Remove a specific row from a 2D Array
body: <p>Given a 2D array and a string, how can I remove a row which does not contain a specific string? So far, I created a nested for loop which iterates through the array, adding all adjacent elements(except the string itself) to an ArrayList. However, I do not want to include elements from rows that exclude the specified string.</p>
  <pre class="lang-java prettyprint-override"><code>String letters[][] = 
      {
          {&quot;a&quot;, &quot;b&quot;}, 
          {&quot;s&quot;}
      };
  </code></pre>
  <p>If the string is &quot;a&quot;, the list should include &quot;b&quot;. However, my list also includes &quot;s&quot; because it is not equal to the string. How can I write my code so that only elements that share the same row as the specified string are added to the list?</p>