我有问题从这个方法返回ArrayList。该方法应该检查给定的保险类型与存储的保险类型。如果匹配,那么该元素将被删除,其余的将被显示。从方法返回ArrayList
请建议的语法,这里返回数组列表
public ArrayList<Insurance> retrieveDetails(String insType){
Iterator<Insurance> itr=insurancelist.iterator();
while(itr.hasNext()) {
Insurance c=itr.next();
if(c.getInsuranceType().equals(insType)) {
insurancelist.remove(c);
}
else
System.out.println(c);
}
这甚至不会编译 - 你有不平衡{} – NickJ
你应该添加return语句 – Abdelhak
u能请建议用于返回数组列表的语法 – Jason