Nika Gudge
asked on
How do i add the matched element from one array into another array
String searchCriteria = request.getSearchCriteria( );
Product product1 = new Product();
Product product2 = new Product();
ArrayList<Product> products = new ArrayList<Product>();
products.add(product1);
products.add(product2);
for (int i=0; i<=products.size(); i++){
if (products.contains(searchC riteria)){
ArrayList<Product> SelectProducts = new ArrayList<SDProduct>();
----- I'm trying to add the products.contains(searchCr iteria) into selectProducts------------ --
}
}
}
SearchProductResult res = new SearchProductResult(Select Products, searchCriteria, showResult);
return res;
Product product1 = new Product();
Product product2 = new Product();
ArrayList<Product> products = new ArrayList<Product>();
products.add(product1);
products.add(product2);
for (int i=0; i<=products.size(); i++){
if (products.contains(searchC
ArrayList<Product> SelectProducts = new ArrayList<SDProduct>();
----- I'm trying to add the products.contains(searchCr
}
}
}
SearchProductResult res = new SearchProductResult(Select
return res;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
will never be true - the type of object in the Collection is Product and the criteria are of type String. You probably need to look at a field of Product