Skip to main content
10 events
when toggle format what by license comment
Mar 2, 2018 at 23:17 comment added user949300 Clearly the ordering does matter, agree there. I'm just quibbling on whether a "filter" is the correct term and technique.
Mar 2, 2018 at 21:03 comment added Idan Arye @user949300 I'd argue that if your logic dictates that you need to only process the elements that appear before an element that fulfills a certain condition, ordering does matter to begin with.
Mar 2, 2018 at 19:55 comment added user949300 @IdanArye never heard of a takeWhile before your comment. Explicitly linking the filter to an ordering strikes me as unusual and hacky, since in a "normal" filter every element gets to return true or false, independent of what comes before or after. In this way you can run things in parallel.
Feb 28, 2018 at 17:41 comment added Jules @IdanArye - there are add-on libraries that add such facilities to the Java streams API (e.g. JOO-lambda)
Feb 28, 2018 at 6:44 comment added Laiv But in Java you still can filter before the iteration. Using streams (1.8 or later) or using Apache Collections (1.7 or earlier).
Feb 28, 2018 at 1:35 comment added Idan Arye @user949300 A takeWhile filter can replace break statements. If you have one - Java for example only gets them at Jave 9 (not that it's that hard to implement it yourself)
Feb 27, 2018 at 20:55 comment added user949300 Most of this answer is fine. But... I can see how filtering a collection could eliminate the need for continue statements, but I don't see how they help much with break.
Feb 27, 2018 at 17:41 history edited Berin Loritsch CC BY-SA 3.0
Add new option
Feb 27, 2018 at 13:51 history edited user CC BY-SA 3.0
Copy-editing
Feb 27, 2018 at 13:43 history answered Berin Loritsch CC BY-SA 3.0