@Test public void testSnapshot() { root.link(Name.simple("bar"), regularFile(10)); root.link(Name.simple("abc"), regularFile(10)); ImmutableSet<Name> snapshot = root.snapshot(); assertThat(snapshot) .containsExactly(Name.simple("abc"), Name.simple("bar"), Name.simple("foo")) .inOrder(); }
public ImmutableSortedSet<Name> snapshot() { ImmutableSortedSet.Builder<Name> builder = new ImmutableSortedSet.Builder<>(Name.displayOrdering()); for (DirectoryEntry entry : this) { if (!isReserved(entry.name())) { builder.add(entry.name()); } } return builder.build(); }
Directory extends File implements Iterable<DirectoryEntry> { public ImmutableSortedSet<Name> snapshot() { ImmutableSortedSet.Builder<Name> builder = new ImmutableSortedSet.Builder<>(Name.displayOrdering()); for (DirectoryEntry entry : this) { if (!isReserved(entry.name())) { builder.add(entry.name()); } } return builder.build(); } }
Directory extends File implements Iterable<DirectoryEntry> { public ImmutableSortedSet<Name> snapshot() { ImmutableSortedSet.Builder<Name> builder = new ImmutableSortedSet.Builder<>(Name.displayOrdering()); for (DirectoryEntry entry : this) { if (!isReserved(entry.name())) { builder.add(entry.name()); } } return builder.build(); } private  Directory(int id); private  Directory(int id, Name rootName); }
Directory extends File implements Iterable<DirectoryEntry> { public ImmutableSortedSet<Name> snapshot() { ImmutableSortedSet.Builder<Name> builder = new ImmutableSortedSet.Builder<>(Name.displayOrdering()); for (DirectoryEntry entry : this) { if (!isReserved(entry.name())) { builder.add(entry.name()); } } return builder.build(); } private  Directory(int id); private  Directory(int id, Name rootName); static Directory create(int id); static Directory createRoot(int id, Name name); DirectoryEntry entryInParent(); Directory parent(); boolean isEmpty(); @NullableDecl DirectoryEntry get(Name name); void link(Name name, File file); void unlink(Name name); ImmutableSortedSet<Name> snapshot(); @Override Iterator<DirectoryEntry> iterator(); }
Directory extends File implements Iterable<DirectoryEntry> { public ImmutableSortedSet<Name> snapshot() { ImmutableSortedSet.Builder<Name> builder = new ImmutableSortedSet.Builder<>(Name.displayOrdering()); for (DirectoryEntry entry : this) { if (!isReserved(entry.name())) { builder.add(entry.name()); } } return builder.build(); } private  Directory(int id); private  Directory(int id, Name rootName); static Directory create(int id); static Directory createRoot(int id, Name name); DirectoryEntry entryInParent(); Directory parent(); boolean isEmpty(); @NullableDecl DirectoryEntry get(Name name); void link(Name name, File file); void unlink(Name name); ImmutableSortedSet<Name> snapshot(); @Override Iterator<DirectoryEntry> iterator();  }