将list转换为String字符串

List cashIdList=new ArrayList<>(set);
cashIdsList = new ArrayList<>(set);
        StringBuilder sb = new StringBuilder();
        if (cashIdsList != null && cashIdsList.size() > 0) {
            for (int i = 0; i < cashIdsList.size(); i++) {
                if (i < cashIdsList.size() - 1) {
                    sb.append(cashIdsList.get(i) + ",");
                } else {
                    sb.append(cashIdsList.get(i));
                }
            }
        }
        return sb.toString();

你可能感兴趣的:(Android基础)