Return to site

โ˜• JAVA TRICK: Creating and chaining predicates

ยท java

You know how to write lambdas to create predicates,

but did you know that the interfaces offers a lot of methods to create and combine them?

๐‚๐š๐ฅ๐ฅ ๐ญ๐ก๐ž ๐ข๐ง๐ฌ๐ญ๐š๐ง๐œ๐ž ๐ฆ๐ž๐ญ๐ก๐จ๐๐ฌ '๐š๐ง๐', '๐จ๐ซ', '๐ง๐ž๐ ๐š๐ญ๐ž' ๐Ÿ๐จ๐ซ ๐›๐จ๐จ๐ฅ๐ž๐š๐ง ๐Ÿ๐จ๐ซ๐ฆ๐ฎ๐ฅ๐š๐ฌ.

 

๐“๐ก๐ž ๐Ÿ๐š๐œ๐ญ๐จ๐ซ๐ฒ ๐ฆ๐ž๐ญ๐ก๐จ๐ '๐ง๐จ๐ญ' ๐ข๐ฌ ๐ ๐ซ๐ž๐š๐ญ ๐ญ๐จ ๐ข๐ง๐ฏ๐ž๐ซ๐ญ ๐š ๐ฆ๐ž๐ญ๐ก๐จ๐ ๐ซ๐ž๐Ÿ๐ž๐ซ๐ž๐ง๐œ๐ž.

 

๐€๐ง๐ ๐ข๐Ÿ ๐ฒ๐จ๐ฎ ๐ฉ๐š๐ฌ๐ฌ ๐ฌ๐จ๐ฆ๐ž ๐จ๐›๐ฃ๐ž๐œ๐ญ ๐ญ๐จ '๐ข๐ฌ๐„๐ช๐ฎ๐š๐ฅ', ๐ฒ๐จ๐ฎ ๐ ๐ž๐ญ ๐š ๐ฉ๐ซ๐ž๐๐ข๐œ๐š๐ญ๐ž ๐ญ๐ก๐š๐ญ ๐œ๐ก๐ž๐œ๐ค๐ฌ ๐ข๐ง๐ญ๐š๐ง๐œ๐ž๐ฌ ๐Ÿ๐จ๐ซ ๐ž๐ช๐ฎ๐š๐ฅ๐ข๐ญ๐ฒ ๐ฐ๐ข๐ญ๐ก ๐ข๐ญ.