Skip to content

Use lambda when possible? #366

Closed
Closed

Description

@jimexist

I can tell that my IntelliJ (gently) warns me of places where anonymous class could be replaced by lambdas, and it can convert all of them in one pass.

I would help to do it but I don't think it's a clear cut that lambdas are better in terms of code readability (works for me, but it depends on many other cases).

So what do you think?

Activity

  1. andimarek commented on Apr 10, 2017

    @andimarek
    Member

    I am not sure about such a brute force method: Using the diamond operator (for generics) for example was straight forward, but as you said: it is not always clear that you should use a lambda, even if it is possible.

  2. bbakerman commented on Apr 11, 2017

    @bbakerman
    Member

    I used to think that explicit inner classes was a good thing but as I worked more on Java8 code bases it became obvious that it wasn't needed very often and Lambdas tended to be quite clear.

    So I would tend to prefer Lambdas unless it introduces exceptionally bad clarity (which is a judgment call I appreciate)

  3. jimexist commented on Apr 19, 2017

    @jimexist
    ContributorAuthor

    i could create a PR and let's see what's changed? @andimarek @bbakerman

  4. jimexist commented on Apr 19, 2017

    @jimexist
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions