[求助]集合中过滤掉重复项
public void temp(){cboAssetsID.removeAllItems();
cboAssetsModel.removeAllItems();
ArrayList aryBH=new ArrayList() ;
ArrayList aryXH=new ArrayList() ;
String assetsCategories=cboAssetsCategories.getSelectedItem().toString();
String sql="select * from assetsInformation where categoryName='"+assetsCategories+"' and assetsState='正常'";
rs=db.getResult(sql);
try {
while (rs.next()) {
aryBH.add(rs.getString(1));
if(!aryXH.contains(rs.getString(6).toString())){
aryXH.add(rs.getString(6).toString());
}
}
rs.close();
} catch (SQLException ex1) {
}
for(int i=0;i<aryBH.size();i++){
cboAssetsID.addItem(aryBH.get(i));
cboAssetsModel.addItem(aryXH.get(i));
}
我想在cboAssetsModel下拉列表中过滤掉重复的型号,为什么总有集合越界异常出现呢 请高手指点
我实在没什么头绪