8bitme / lambdaj

Automatically exported from code.google.com/p/lambdaj
Apache License 2.0
0 stars 0 forks source link

Add method alias for LambdaCollection.retain #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I started using LambdaJ I had little trouble finding method filter (aka 
select) in LambdaCollections (fluent interface). Name "retain" IMO is not so 
good, as it suggest side effect (mutability, see for example 
Collections.retainAll). I would suggest to add alias (or even make retain 
deprecated) and use name filter as it is the most often used name for this 
operation. See http://en.wikipedia.org/wiki/Filter_%28higher-order_function%29.

If not filter than at least select... :-)

Original issue reported on code.google.com by kopperni...@gmail.com on 28 Dec 2010 at 2:09

GoogleCodeExporter commented 9 years ago
I see your point, but I was trying to make fluent collection as 
"english-readable" as possible. When you pass the list to be filtered ad a 
parameter, as in the static method, a method named "select" makes sense also 
because it remembers a SQL statement. But, in my opinion, when you invoke a 
method on the list (i.e. the list is the subject of the action) a method named 
retain is more fluently readable.

Original comment by mario.fu...@gmail.com on 9 Jan 2011 at 4:49

GoogleCodeExporter commented 9 years ago
I am sorry. This is my mistake. I thought retain is side-effect free. Thanks 
for explaining "whys".

Original comment by adamcze...@gmail.com on 9 Jan 2011 at 9:58