Home
Sign Up
Sign In
V2EX
›
问与答
Java stream 一个 ArrayList,在 ForEach 下如何获得前一个元素?
8e47e42
·
Apr 1, 2020
· 1986 views
This topic created in 2412 days ago, the information mentioned may be changed or developed.
如题问,for loop 能很容易的读到 i-1,但是 for each 下面怎么获得呢?
for
arraylist
foreach
i-1
3 replies
•
2020-04-01 13:57:27 +08:00
lhx2008
Apr 1, 2020
1
不要使用 forEach
optional
Apr 1, 2020
2
迭代器是不能获取前一个的,除非你自己记下来
SoloCompany
Apr 1, 2020
1
3
https://stackoverflow.com/questions/20470010/collect-successive-pairs-from-a-stream
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1611 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 29ms ·
UTC 14:03
·
PVG 22:03
·
LAX 06:03
·
JFK 09:03
♥ Do have faith in what you're doing.
❯