Skip to content

FluentPredicate #334

Closed
Closed
@gissuebot

Description

@gissuebot

Original issue created by blank101 on 2010-02-26 at 11:00 PM


I find the following very annoying:

Predicates.and(Predicates.not(Predicates.in(someCollection)),Predicates.not
Null())

...etc.

I wrote a (very bare) wrapper implementation of Predicate (attached), which
provides for all the methods in Predicates in a functional style (ala the
similar proposal for Iterables), which allows some thing like:

ComposablePredicate.in(someCollection).not().and(Predicates.notNull())

which I think is more clear than the example above. I don't see this in the
dead ideas or otherwise closed issues, so I thought I'd suggest it.

The one implementation decision I'm not sure about is an immutable vs
mutable delegate, but I'm pretty happy with the immutable version.

N.B.: this composition problem also applies to functions: e.g.,
Functions.blah(Functions.blah(Functions.blah( ... ) becomes rapidly
unreadable for any substantive number of functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions