title: Java remove if condition don't work as it have to
body: <p>Can have few plans and few tariffs. Need to remove all tariffs from plan, when <code>remove == N</code>. Tried to do it with this code, but nothing happens. I mean, I debugged and saw in console, that <code>remove is T</code>, but code don't remove tariffs anyway. How to fix removing?</p>
  <pre><code>    remove = &quot;Y&quot;;
      List&lt;Plan&gt; plan = new ArrayList&lt;Plan&gt;();
      plan.addAll(plan2);
      
      for (int i = 0; i &lt; plan.size(); i++) { 
          List&lt;Tariff&gt; tariff = new ArrayList&lt;Tariff&gt;();
          tariff.addAll(plan.get(i).getTariff());
  
          for (int j = 0; j &lt; tariff.size(); j++) {  
              if(tariff.get(j).getCode().equals(&quot;N&quot;)) {
                  remove = &quot;N&quot;;
              }
          }
          plan.get(i).getTariff().removeIf(condition -&gt; remove.equals(&quot;Y&quot;));
      }
  </code></pre>