title: Filter objects inside an ArrayList as a result of multiple conditions in Processing (Java)
body: <p>I've searched a solution for this and haven't found exactly what I need. </p>
  
  <p>I'm wondering how to create a generic method that accept a <strong>variable</strong> number of conditions, and returns a subset of an ArrayList according to those conditions. Something like:</p>
  
  <pre><code>ArrayList&lt;Measure&gt; dataFiltered = allData.filter(
    temperature: 20,
    humidity: &lt;80,
    ...
  );
  </code></pre>
  
  <p>I have no idea how to retrieve this conditions in the method declaration, and how to point to those selected variables to compare and create a subset of filtered elements:</p>
  
  <pre><code>public ArrayList&lt;Measure&gt; filter( /* ??? */ ) {
    ArrayList&lt;Measures&gt; filteredMeasures = new ArrayList();
  
    /* Manage conditions in here */
  
    for(Measure measure : allMeasures) {
      boolean allConditionsOK = true;
      for(condition : conditions) {
        // Point to specific variable set in conditions, and compare with value
        if(measure.[condition(variable)] != condition(value)) {
          allConditionsOK = false;
          break;
        }
      }
      if(allConditionsOK) filteredMeasures.add(measure);
    }
    return filteredMeasures;
  }
  </code></pre>