java-List或JSONArray使用remove方法删除元素
JSONArray ja_title = JSONArray.parseArray(sreTitle.getTitle());//第一种ja_title.removeAll(titleList)//第二种Iterator iter = ja_title.iterator();while (iter.hasNext()) {String str = (String) iter.next();if (
·
JSONArray ja_title = JSONArray.parseArray(sreTitle.getTitle());
//第一种
ja_title.removeAll(titleList)
//第二种
Iterator<Object> iter = ja_title.iterator();
while (iter.hasNext()) {
String str = (String) iter.next();
if (titleList.contains(str)) {
iter.remove();
}
}
更多推荐
所有评论(0)