Design pattern for filtering a collection of items?

前端 未结 6 952
既然无缘
既然无缘 2021-02-04 04:43

Imagine the typical type of application where you have a list of items with different properties. E.g. a tree-view with 100 items, each having a name, a rating

6条回答
  •  余生分开走
    2021-02-04 05:27

    I like the filter with predicate of Google Collections and I would implement something very similar if I couldn't use it. You may want to check this answer to a similar question for a implementation example. The implementation is in Java but, well, you'll see the pattern.

提交回复
热议问题