I am having a runtime error on setid method saying ” The method ids(List) in the type dtoClass is not applicable for the arguments (boolean) “. below is the code. What error it could be
JSONArray jsonInnerArray = null;
jsonInnerArray = jsonObj.getJSONArray("ids");
List<String> ids = new ArrayList<String>();
dtoClass.setid(ids.add(jsonInnerArray.get(i).toString()));
DTO Class
public class dtoClass{
private List<String> ids = null;
public List<String> getids() {
return tracking_ids;
}
public void setids(List<String> ids) {
this.ids = ids;
}
}
That’s because
ids.addreturns aboolean. See javadoc forList.addTo solve the issue change the code to: