我的这段代码运行缓慢
userMenus
.forEach(
ccy -> configuredAlerts
.add(new ConfiguredAlerts(
ccy, Stream
.concat(pricealertsXMenu.stream()
.filter(pac -> pac.getMenu().equals(ccy))
.map(pac -> new MenuAlarm("priceAlert",pac.getPriceAlert().getMenuAlertGroup().getName()))
.distinct(),
percentagealertsXMenu.stream()
.filter(pac -> pac.getMenu().equals(ccy))
.map(pac -> new MenuAlarm("percentageAlert",pac.getPercentageAlert().getMenuAlertGroup().getName()))
.distinct())
.distinct().collect(toList()))));
我将.stream()替换为.parallelStream()以使其更快,但运行速度甚至更慢