Returns the product list.returnan Iterator of ProductBeans ProductBean[] products = null; synchronized(cart) { products = new ProductBean[cart.size()]; cart.toArray(products); } return products;
ProductBean[] products = null; synchronized(cart) { products = new ProductBean[cart.size()]; cart.toArray(products); } return products;
Returns the total price for all products in the cartreturnthe total price float total = 0; Iterator prods = cart.iterator(); while (prods.hasNext()) { ProductBean product = (ProductBean) prods.next(); float price = product.getPrice(); total += price; } return total;
float total = 0; Iterator prods = cart.iterator(); while (prods.hasNext()) { ProductBean product = (ProductBean) prods.next(); float price = product.getPrice(); total += price; } return total;
Adds a product to the cart, if it's not already there.paramproduct the ProductBean if (product != null && cart.indexOf(product) == -1) { cart.addElement(product); }
if (product != null && cart.indexOf(product) == -1) { cart.addElement(product); }