list中不能直接add基本数据类型,只能add对象
错误:
ArrayList list = new ArrayList();
正确:
ArrayLisr<String> list = new ArrayList<>();
public List findHonorOptions() { ArrayList<String> arrayList = new ArrayList<>(); List<Honor> honorList = _honorDao.findHonorList(); if(honorList !=null && honorList.size()!=0){ for(Honor honor : honorList){ String honorId = honor.getHonorId(); arrayList.add(honorId); } } return arrayList; }