title: Java stream run atleast once
body: <p>I have a list: <code>List&lt;Filter&gt;</code>. I want to make a call to a downstream API which can only take a single <code>Filter</code> in it's request. So I can do something like this:</p>
  <pre><code>filters.forEach(filter -&gt; callAPI(someId, filter);
  </code></pre>
  <p>The problem with this is if the filters are empty, I won't even make a single call to the API. To solve this I tried something like this:</p>
  <pre><code>if (filters.isEmpty()) {
      callAPI(someId, null);
  } else {
      filters.forEach(filter -&gt; callAPI(someId, filter);
  }
  </code></pre>
  <p>Is there a better way of doing this ?</p>