title: Can I somehow exclude or filter out a value from Collections.Min/Collections.Max in java?
body: <p>so I'm using Collections.min to find an object in an ArrayList, that contains the smallest integer value in one of it's elements. Basically comparing every element in the list.</p>
  
  <p>Now, there are some objects in the list, that don't contain a value, so I had to set them to -1.</p>
  
  <p>How would I exclude all the elements in the list that have an int value of -1, I don't see how I can apply an if statement.</p>
  
  <pre><code>temp = Collections.min(PollutionDatasetList, Comparator.comparingInt(Measurement::getLevel));
  </code></pre>
  
  <p>PollutionDatesetList - my list</p>
  
  <p>Measurement - my class that's contained within the list</p>
  
  <p>GetLevel - the integer value I'm comparing.</p>