title: Stream filter criteria for list of params
body: <p>today I met an interesting problem with stream API filter. 
  Namely, the problem is as follows: We have a list of parameters to filter as a function argument. Using the streams we want to filter all the records and return the ones that match the parameters we gave as the function argument. For example [Car, 2012, 50000, Audi]. I realize that in this situation I could use Criteria API or Full Search Text but I would like to do it without additional API only using Java streams.</p>
  
  <p>Customer.class</p>
  
  <pre><code>
  public class Customer {
  
    @Id
    @GeneratedValue
    private Long id;
  
    private String name;
    private Integer age;
  
    @OneToMany(mappedBy = "customer")
    List&lt;CustomerOrder&gt; customerOrders;
  
  }
  </code></pre>
  
  <p>Product.class</p>
  
  <pre><code>public class Product {
  
    @Id
    @GeneratedValue
    private Long id;
    private String name;
    private BigDecimal price;
  
    @ToString.Exclude
    @EqualsAndHashCode.Exclude
    @OneToMany(mappedBy = "product")
    List&lt;CustomerOrder&gt; customerOrders;
  }
  </code></pre>
  
  <p>CustomerOrder.class</p>
  
  <pre><code>public class CustomerOrder {
  
    @Id
    @GeneratedValue
    private Long id;
    private String description;
    private Integer quantity;
  
    @ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name = "customer_id")
    private Customer customer;
  
    @ManyToOne()
    private Product product;
  
  }
  </code></pre>
  
  <p>With full Lombok utility. </p>
  
  <p>The problem is that the list of arguments may vary. We can blend an argument order to something like [50000, Audi, Car, 2012] and we suppose to receive the same result. Otherwise, assuming that we would have a list of parameters that would be previously validated by us for correctness, we could program it on a filtering basis after the next parameters, but in this case, we are not so sure. </p>
  
  <p>Problem clarification: </p>
  
  <p>We give as an argument a list of parameters we want to search for: [50,000, Audi, Car, 2012]. In normal case, assuming that the order will always be correct, so we first specify the price, then the brand, type of goods and year, we could filter the records one by one using a standard filter with the stream API, i.e. first search at the price, then by the brand and so on. The problem occurs when the order is changed and we give first the yearbook then the brand then the price and type of goods. In this situation, our filter will not work because it will not find anything because we changed the order of items that we gave as an argument for our filtering function. In this situation, the part of our filter responsible for the search by parameter: the price will receive the year of the goods, which for obvious reasons will not return decent results assuming. I hope that this time I summarized the problem as best as possible. </p>
  
  <p>Thank you so much for pieces of advice.</p>