Skip to content

Add folder/file Composite example - #83

Merged
mperor merged 2 commits into
masterfrom
PATTERN/complex-composite
Oct 22, 2026
Merged

mperor merged 2 commits into
masterfrom
PATTERN/complex-composite

Conversation

@mperor

@mperor mperor commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Second Composite pattern example, next to AbilityTreeCompositeTest: a folder/file tree where Folder (composite) and File (leaf) share AddressablePath, and Folder.find(Predicate<String>) searches the whole tree recursively.

  • Revived from a stale branch (Jan 2025), rebased onto current master
  • Replaced System.out.println with assertions: matching folder + its files, files only, no matches
  • Renamed leftover complexTag lambda parameter to folder

Quiz: find adds matching direct children first and only then recurses — what order would you get for name -> name.startsWith("main"), and how would you change find to return a depth-first (pre-order) listing?

@github-actions

Copy link
Copy Markdown

Test Results

258 tests  +1   255 ✅ +1   4s ⏱️ -1s
 77 suites +1     3 💤 ±0 
 77 files   +1     0 ❌ ±0 

Results for commit 5446dd5. ± Comparison against base commit d3b4ee3.

This pull request skips 1 and un-skips 1 tests.
pl.mperor.lab.java.design.pattern.creational.singleton.SingletonTest ‑ testLazyInitialized()
pl.mperor.lab.java.design.pattern.creational.singleton.SingletonTest ‑ testSerializationSafe()

@mperor mperor self-assigned this Oct 22, 2026
@mperor
mperor merged commit 1b151e0 into master Oct 22, 2026
2 checks passed
@mperor
mperor deleted the PATTERN/complex-composite branch October 22, 2026 20:51
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.

1 participant