最佳答案
Returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream. If this stream contains fewer than n elements then an empty stream will be returned.
all.stream().skip(Math.max(0, all.size() - n)).forEach(doSomething);
关于java - 从流中获取最后 n 个元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30476127/