Skip to content

#1817 add Walked iterable as Elegant Files.walk equivalent - #1899

Open
edmoffo wants to merge 1 commit into
yegor256:masterfrom
edmoffo:1817-files-walk-elegant
Open

#1817 add Walked iterable as Elegant Files.walk equivalent#1899
edmoffo wants to merge 1 commit into
yegor256:masterfrom
edmoffo:1817-files-walk-elegant

Conversation

@edmoffo

@edmoffo edmoffo commented Jun 13, 2026

Copy link
Copy Markdown

Closes #1817

Adds org.cactoos.io.Walked as the Elegant equivalent of Files.walk(Path, int), iterating every path under a starting directory up to a bounded depth. Directory already wraps the unbounded Files.walk(Path) call, so this PR fills in the depth-controlled variant the issue asked for. Constructors mirror Directory: Walked(Path, int) and Walked(File, int), both delegating to a private Walked(Scalar<Path>, int).

A caller that today writes try (Stream<Path> paths = Files.walk(start, 2)) { ... } can now write new Walked(start, 2) and treat it as any other cactoos Iterable<Path>.

Locally ran mvn -Dtest='DirectoryTest,WalkedTest' -Dhone.skip=true -Djacoco.skip=true test (4 tests pass) and mvn -Pqulice -Dhone.skip=true -Djacoco.skip=true -DskipTests verify (BUILD SUCCESS, qulice clean). Could not exercise the full mvn matrix here because hone-maven-plugin requires Docker; CI on the PR will cover the rest.

Wrap Files.walk(path, depth) behind an Iterable<Path> primitive so
callers can walk a file tree to a bounded depth without touching the
Stream API directly. Directory already covers the unbounded case; this
adds the depth-controlled variant requested in the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files.walk equivalent in Elegant style

2 participants