我有以下代码想要在每个循环中中断或继续:-
List<Map<String, Object>> dataSource = new ArrayList<>();
Map<String, Object> rowMap2 = new LinkedHashMap<>();
dataSource.stream().forEach(item -> {
Map<String, Object> rowMap2 = new LinkedHashMap<>();
if(item.get("Security").toString().equals("SECURITIES")){
rowMap2 = item;
for(Map.Entry<String, Object> entry : rowMap2.entrySet()){
if(entry.getKey().equalsIgnoreCase("Security")){
entry.getKey().replace(entry.getKey(), mainType);
}
}
dataSource2.add(rowMap2);
// I want to continu here.
}
if(entry.getKey().equals("Stock")){
rowMap2.put(mainType, "SECURITIES");
rowMap2.put(subType, entry.getValue());
dataSource2.add(rowMap2);
// I want to break from this loop here
}
dataSource2.add(rowMap2)
});
请让我知道我该怎么做?