三种常用的对应list集合的双重遍历,直接上代码
package com.collections.lists;
}
package com.collections.lists.vo;
public class Product {
@SuppressWarnings("product")
private int id;
private String name;
private int pcId;//商品类型编号
private int price;
private int num;
public Product() {
// TODO Auto-generated constructor stub
}
public Product(int id, String name, int pcId, int price, int num) {
super();
this.id = id;
this.name = name;
this.pcId = pcId;
this.price = price;
this.num = num;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPcId() {
return pcId;
}
public void setPcId(int pcId) {
this.pcId = pcId;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
package com.collections.lists.vo;
public class ProductClassify {
@SuppressWarnings("productclassify")
private int id;//编号
private int pcId;//商品类型编号
private String pName;//商品分类名字
public ProductClassify() {
// TODO Auto-generated constructor stub
}
public ProductClassify(int id, int pcId, String pName) {
super();
this.id = id;
this.pcId = pcId;
this.pName = pName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPcId() {
return pcId;
}
public void setPcId(int pcId) {
this.pcId = pcId;
}
public String getpName() {
return pName;
}
public void setpName(String pName) {
this.pName = pName;
}
@Override
public String toString() {
return "ProductClassify [id=" + id + ", pcId=" + pcId + ", pName="
+ pName + "]";
}
}
原文:http://blog.csdn.net/cuiwei1026522829/article/details/19208929