filter

Filters data in a map< K, V >, list< T >, or set< T >.

Parameters:

No. Type Comments
1 map< K, V >, list< T > or set< T > The object to be filtered
2 A lambda that accepts 1 or 2 parameters and returns a boolean result. When 1st parameter to filter is a list< T > or set< T >,then the 1st parameter to lambda is one of its elements.
When 1st parameter to filter is a map< K, V >, the lambda accepts the key and value per entry.

Returns:

A map< K, V >, list< T > or set< T > that has been filtered.

Usages:

  • filter( v:list<T>, e => boolean-expression ) : list<T>
  • filter( v:set<T>, e => boolean-expression ) : set<T>
  • filter( v:map<K, V>, (k, v) => boolean-expression ) : map<K, V>