3 ms·
I think popularity implies usefulness to a degree, but I don't disagree that it might be unfair. As for the functional approach to collection operations, I per
by sfn42 3y ago
I think popularity implies usefulness to a degree, but I don't disagree that it might be unfair.
As for the functional approach to collection operations, I personally like it a lot. When I used Java, I used streams a lot, now that I primarily use C# I use LINQ a lot. I think in a lot of cases the syntax is more expressive and hence more readable than loops, but both have their place and both can be used badly.
Often times you can write a simple statement that does a lot of work and is very clear to the reader, assuming they are familiar with the API/paradigm. Equivalent loop implementations can be significantly more verbose which generally reduces readability. Other times a simple task can require a very convoluted functional approach whereas a loop implementation would be fairly straight forward.
As with everything there are pros and cons, they both have their niche but personally I think I use the functional approach more than I use loops these days.