DirectoryStream implements Iterable<DirectoryEntry> { public DirectoryStream tail(long fromCookie) { final DirectoryEntry cookieEntry = new DirectoryEntry("", null, null, fromCookie); return new DirectoryStream(verifier, entries.tailSet(cookieEntry, false)); } DirectoryStream(Collection<DirectoryEntry> entries);  DirectoryStream(byte[] verifier, Collection<DirectoryEntry> entries);  DirectoryStream(byte[] verifier, NavigableSet<DirectoryEntry> entries); byte[] getVerifier(); @Override Iterator<DirectoryEntry> iterator(); DirectoryStream tail(long fromCookie); DirectoryStream transform(Function<? super DirectoryEntry, DirectoryEntry> function); final static byte[] ZERO_VERIFIER; }
@Test public void testTail() { DirectoryStream tail = stream.tail(3); assertEquals(tail.iterator().next().getCookie(), 4); assertArrayEquals(stream.getVerifier(), tail.getVerifier()); }