/** * Checks that the given name is not "." or "..". Those names cannot be set/removed by users. */ private static Name checkNotReserved(Name name, String action) { if (isReserved(name)) { throw new IllegalArgumentException("cannot " + action + ": " + name); } return name; }
/** * Creates an immutable sorted snapshot of the names this directory contains, excluding "." and * "..". */ 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(); }
/** * Checks that the given name is not "." or "..". Those names cannot be set/removed by users. */ private static Name checkNotReserved(Name name, String action) { if (isReserved(name)) { throw new IllegalArgumentException("cannot " + action + ": " + name); } return name; }
/** * Creates an immutable sorted snapshot of the names this directory contains, excluding "." and * "..". */ 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(); }