解析String 字符串为List集合
ArrayList<String> itemsList= Arrays.asList(items.split("\\|")
List<String> itemsList= Arrays.asList(items.split("\\|")
final Iterator<String> iterator = itemsList.iterator();
while (iterator.hasNext()) {
final String pushItem = iterator.next();
log.info("pushItem:{}", pushItem);
if (xxx) {
iterator.remove();
continue;
}
}
会报错
问题排查参考文档:https://blog.csdn.net/thekenofdis/article/details/78289067
解决方案
ArrayList<String> itemsList = new ArrayList<>(Arrays.asList(items.split("\\|")));