Skip to content

Replace manual iterator join with String.join in DefaultPrompter - #123

Merged
slachiewicz merged 1 commit into
masterfrom
agent/sweep-interactivity-prompter
Nov 18, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/sweep-interactivity-prompter

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Why

DefaultPrompter.formatMessage built the parenthesised possible-values
suffix ((a/b/c)) with a manual Iterator loop and a separator check.
String.join("/", ...) expresses the same result in one call and removes
the need for the java.util.Iterator import.

Area

Production code — org.codehaus.plexus.components.interactivity.DefaultPrompter.

Changes

  • Replaced the Iterator-based join loop with String.join("/", possibleValues)
    inside a single append chain.
  • Removed the now-unused java.util.Iterator import.
  • Behavior is unchanged, including the null/empty guard.

Verification

  • JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home mvn -B -o spotless:apply — BUILD SUCCESS (0 files changed)
  • mvn -B -o spotless:check — BUILD SUCCESS
  • mvn -B -o test — BUILD SUCCESS; Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

formatMessage built the '(a/b/c)' possible-values suffix with an explicit Iterator loop. String.join('/', possibleValues) yields the same result in one call and lets us drop the java.util.Iterator import.
@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Nov 18, 2026
@slachiewicz
slachiewicz merged commit 9e5b05b into master Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Cleanup, refactoring or other internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant