How to code Stream.findNth()?
问题 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 wondering how the below function can be written using Stream API. static curPipeNumber = 0; /** skipToEntry() updates 'curPipeNumber' to 'pipeNumber' and returns the first byte position of the word before the ('pipeNumber')-th pipe. * It does so by reading and ignoring unnecessary bytes from the buffer. * e.g., */ static int skipToEntry(byte[] buf, int len,