Skip to content

Fix predicate-not modern example to compile on Java 11 - #159

Merged
brunoborges merged 2 commits into
mainfrom
copilot/fix-predicate-not-issue
Aug 5, 2026
Merged

Fix predicate-not modern example to compile on Java 11#159
brunoborges merged 2 commits into
mainfrom
copilot/fix-predicate-not-issue

Conversation

CopilotAI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The streams/predicate-not modern snippet used Stream.toList(), which is only available in Java 16+, while the pattern is marked as JDK 11. This PR aligns the example with Java 11-compatible stream collection syntax.

  • Scope

    • Updated the modern code example in content/streams/predicate-not.yaml.
    • Updated the corresponding proof file proof/streams/PredicateNot.java to keep it in sync.
  • Code change

    • Replaced Java 16+ terminal operation with Java 11-compatible collector:
    List<String> nonEmpty = list.stream()
    .filter(Predicate.not(String::isBlank))
    .collect(Collectors.toList());
  • Compatibility impact

    • Preserves the intended focus of the pattern (Predicate.not(...) introduced in Java 11) while removing the accidental dependency on newer Stream APIs.

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
@brunoborges
brunoborges marked this pull request as ready for review August 5, 2026 18:38
CopilotAI changed the title [WIP] Fix compilation error with Predicate.not() for Java 11Fix predicate-not modern example to compile on Java 11Aug 5, 2026
CopilotAI requested a review from brunoborgesAugust 5, 2026 18:40
@brunoborges
brunoborges merged commit 453b322 into mainAug 5, 2026
1 check passed
Sign up for freeto 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.

[Code Issue] Predicate.not()による否定

2 participants

@brunoborges