@@ -0,0 +1,1307 @@
+public class BuyItem %7B%0A%09private ProductInfo product;%0A%09private Integer amount = 1;%0A%09%0A%09public BuyItem()%7B%7D%0A%09%0A%09public BuyItem(ProductInfo product) %7B%0A%09%09this.product = product;%0A%09%7D%0A%09public ProductInfo getProduct() %7B%0A%09%09return product;%0A%09%7D%0A%09public void setProduct(ProductInfo product) %7B%0A%09%09this.product = product;%0A%09%7D%0A%09public Integer getAmount() %7B%0A%09%09return amount;%0A%09%7D%0A%09public void setAmount(Integer amount) %7B%0A%09%09this.amount = amount;%0A%09%7D%0A%09%0A%09@Override%0A%09public int hashCode() %7B%0A%09%09String result = product.getId().toString();%0A%09%09if(!product.getStyles().isEmpty()) result +=%22-%22+ product.getStyles().iterator().next().getId();%0A%09%09return result.hashCode();%0A%09%7D%0A%09//%E8%B4%AD%E7%89%A9%E8%BD%A6%E9%87%8C%E7%9A%84%E4%BA%A7%E5%93%81,%E6%9C%80%E5%A4%9A%E5%8F%AA%E5%8F%AF%E8%83%BD%E5%AD%98%E5%9C%A8%E4%B8%80%E4%B8%AA%E6%A0%B7%E5%BC%8F%0A%09@Override%0A%09public boolean equals(Object obj) %7B%0A%09%09if (this == obj)%0A%09%09%09return true;%0A%09%09if (obj == null)%0A%09%09%09return false;%0A%09%09if (getClass() != obj.getClass())%0A%09%09%09return false;%0A%09%09final BuyItem other = (BuyItem) obj;%0A%09%09if (product == null) %7B%0A%09%09%09if (other.product != null)%0A%09%09%09%09return false;%0A%09%09%7D else if (!product.equals(other.product))%0A%09%09%09return false;%0A%09%09%0A%09%09if(product.getStyles().size()!=other.product.getStyles().size())%7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09Integer style = product.getStyles().iterator().next().getId();%0A%09%09Integer othersytle = other.product.getStyles().iterator().next().getId();%0A%09%09if(!style.equals(othersytle)) return false;%0A%09%09return true;%0A%09%7D%0A%09%0A%7D%0A

Create BuyItem.java