使用Java流就地修改重复项

问题描述 投票:0回答:2

我有一个如下所示的数组列表。

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

并且我想输出为

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

我尽力使用Java 8流函数来实现这一点,但是无法做到。甚至有可能使用Streams进行此操作,还是我应该蛮力使用(可能是冗长而又不整洁的循环?

java-8 stream
2个回答
0
投票

您可以使用mappeek


0
投票

您可以这样做,

© www.soinside.com 2019 - 2024. All rights reserved.