I am trying to filter an array list to remove objects that do not match a set of criteria input by a user. The object has 3 lists. See below for example.
public class A {
public String [] a={"a", "b", "c"};
public String [] c={"a", "b", "c"};
public String [] d={"a", "b", "c"};
}
I'm trying to write a way of search this object to see if it matches data input into a search dialog. For example, i want all objects that have "a" in array a, "c" in array b and * in array c.
for(int i = 0; i < products.length; i++)
{
reactionData = select(reactionData, having(on(A.class).a,Every.everyItem(containsString(products[i]))));
}
I thought of doing something like this for each array im searching through but it seems inefficient. Not to mention that the reactionData array would just be replaced on each search.
If some one could help me solve this or perhaps point me to some useful sites explaining how to utilise hamcrest with lambdaj that would be ideal.
EDIT
output = filter(having(on(Reaction.class).getChemicalProducts(), hasItems(products)), reactionData);
the above matcher has to match every item in products. I'm looking for it to match any item in products