Skip to content

Add filterStatic (vs. filter) to ConstraintStreamsΒ #1806

@larsbeck

Description

@larsbeck

We often write statements like: factory.forEach(Shift.class).filter(someCondition) where someCondition only uses data that never changes (static).
Whenever a shift changes in the example above, the filter is evaluated. Running this evaluation often (over and over) is costly.

Instead of evaluating the filter every time a shift changes, I propose to cache the filtered list of shifts.

We have worked around this issue by introducing a new type, for which we precompute the filtering and use that instead of the original Shift.class.

Another positiv effect of providing something like filterStatic and describing the difference to filter may be that it may make the behavior of filter even more clear.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions