How-to articles, tricks, and solutions about FILTER

How to filter a Java Collection (based on predicate)?

To filter a Java collection based on a predicate, you can use the removeIf method of the Collection interface. This method removes all elements from the collection that match the specified predicate.

List comprehension vs. lambda + filter

List comprehension and the combination of lambda functions and the filter() function in Python are both used to filter a list and return a new list with only the elements that satisfy a certain condition.

XSS filtering function in PHP

Here is an example of a basic XSS filtering function in PHP: