Skip to content

bool Function(...) tear-off could accept the ! operator in front #2505

Closed
@FMorschel

Description

@FMorschel

I've recently run into a project where I had a list of objects and wanted to test and process them using the Iterable.*where* / Iterable.*when* / Iterable.*while* methods. So I've created a function where it received a bool Function(MyClass element) test parameter.

In some places, I would use the positive results of this test, so I could easily do iterable.*where*(test) but in other places I would use the negative results, so I would need to write iterable.*where*((e) => !test(e)).

This made me wonder whether iterable.*where*(!test) should exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions