How to code Stream.findNth()?

后端 未结 1 441
太阳男子
太阳男子 2020-12-10 20:18

Similar to Stream.findFirst(), is there a way to write Stream.findNth()?

I\'m practicing Java 8 by rewriting some legacy code. And, I\'m wo

相关标签:
1条回答
  • 2020-12-10 20:57
    OptionalInt result = stream.skip(n-1).findFirst();
    
    0 讨论(0)
提交回复
热议问题