prettier-java icon indicating copy to clipboard operation
prettier-java copied to clipboard

Docs: lambdas in examples

Open xenoterracide opened this issue 11 months ago • 3 comments

Probably the biggest formatting improvement over other formats in java is that lambda's really are prettier. Most of the other formats were designed prior to the existence and things like Sun, or Google's just never seem to have caught up.

P.S. would be nice to have the example in the README

xenoterracide avatar Apr 07 '25 14:04 xenoterracide

The place would be https://github.com/jhipster/prettier-java/tree/main/website/docs

Maybe one can pickup some examples from our try to switch to prettier-java? 2k files can't be wrong 😅 https://github.com/JabRef/jabref-koppor/pull/717

koppor avatar Aug 19 '25 22:08 koppor

With the playground the xample from https://github.com/palantir/palantir-java-format#motivation--examples are as follows:

private static void configureResolvedVersionsWithVersionMapping(
  Project project
) {
  project
    .getPluginManager()
    .withPlugin("maven-publish", (plugin) -> {
      project
        .getExtensions()
        .getByType(PublishingExtension.class)
        .getPublications()
        .withType(MavenPublication.class)
        .configureEach((publication) ->
          publication.versionMapping((mapping) -> {
            mapping.allVariants(
              VariantVersionMappingStrategy::fromResolutionResult
            );
          })
        );
    });
}
var foo = SomeType.builder()
  .thing1(thing1)
  .thing2(thing2)
  .thing3(thing3)
  .build();

Two spaces need to be kept for the public homepage (as they are already there) --> https://www.jhipster.tech/prettier-java/docs

koppor avatar Aug 19 '25 22:08 koppor

Strongly related: https://github.com/jhipster/prettier-java/issues/627

koppor avatar Sep 13 '25 13:09 koppor