Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Static Simplify rich .filter or .anyMatch to .map #465

Open
blacelle opened this issue Mar 12, 2023 · 0 comments
Open

Additional Static Simplify rich .filter or .anyMatch to .map #465

blacelle opened this issue Mar 12, 2023 · 0 comments

Comments

@blacelle
Copy link
Member

One would like to turn:

List.of().stream().anyMatch( element -> element.getClassName().equals(targetClassName))

into

 .stream().map(Element::getClassName).anyMatch( element -> element.getClassName().equals(targetClassName))

see eu.solven.cleanthat.engine.java.refactorer.mutators.SimplifyStreamFilterWithMap


You want also want to implement a mutator by your self:

  • Consider eu.solven.cleanthat.engine.java.refactorer.mutators.EmptyControlStatement as an example
  • Add tests in eu.solven.cleanthat.engine.java.refactorer.cases.do_not_format_me.EmptyControlStatementCases
  • Wire tests through eu.solven.cleanthat.engine.java.refactorer.cases.TestEmptyControlStatementCases
  • Open a PR from a personal fork, allowing maintainers to edit your PR.
  • Thanks!
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

No branches or pull requests

1 participant