Subject: One sign to watch for

From: Your Heart At Risk <[email-masked]>
Date: Fri, 03 Apr 2015 07:05:51 -0700

Health NEW REPORT

Will you have a Heart Attack today? http://www.elkhartcardiacare.com/latinizes-906_promonarchists.html

There are 4 terrifying things that can happen before you die of a heart attack
Don't Ignore These Signs  (http://www.elkhartcardiacare.com/latinizes-906_promonarchists.html)
* Lower Your Risk by 91%

* https://www.healthypeople.gov/2020/topics-objectives/topic/heart-disease-and-stroke

Do you have a family histoy of heart diseaase? (http://www.elkhartcardiacare.com/latinizes-906_promonarchists.html)

Why you may be at a higher risk then you think. Take 10 seconds out of your day and be sure to do this every morning. Read More >> http://www.elkhartcardiacare.com/latinizes-906_promonarchists.html

-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~-=~

HET Welness - Powell Tech Labs - 804 Glendale - Clarksville TN - [rem-settings] http://www.elkhartcardiacare.com/choice_sneakingly-895/imbibe_089-sheiks.php

Certainly not an answer, but in Python, you'd do it like this:[list(v) for k, v in groupby(lst, key=lambda x: x is not None) if k]. There isCollectors.groupingBy, but to be honest I don't understand how it works...tobias_kMar 17 at 10:30
Python is teasing me more and more every day :)Collectors.groupingBymaps the list by a property: for example grouping["a", "b", "aa", "aaa"]byString::lengthwould produce{1:["a", "b"], 2:["aa"], 3:["aaa"]}... I don't know if it could be used in my caseOneirosMar 17 at 10:39
1

The problems comes form the fact that the sequence is highly important here but Streams are designed to work on independent pieces of data. This is why I think that there is no solution that will not be equivalent to a Java 7's foreach. My solution converts the problem of "Split List" into a problem of "Split String" for which Java natively implemented a solution.Arnaud DenoyelleMar 17 at 10:49
12

I hope this goes without saying but, for production code, please keep it simple and just use for-loops. This is a great training exercise question. But it worries me that some of the solutions posted below could one day end up in production code (they got a high-score on Stackoverflow so theymustbe the right way to do it). Some poor sap will tear their hair out trying to understand thisMr SpoonMar 17 at 10:54
1

ArnaudDenoyelle I don't agree with you, Alexis C. showed you that it is possible (I'm testing his solution) @Mr Spoon yes, this is just a training exerciseOneirosMar 17 at 11:00