Created
August 30, 2015 10:51
-
-
Save amaembo/0bc8e982d179f2e45d7a to your computer and use it in GitHub Desktop.
Collect (see http://stackoverflow.com/a/32291089/4856258 )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokens.stream().collect(() -> new ArrayList<String>(), (l, e) -> { | |
if(l.isEmpty() || !l.get(l.size()-1).toUpperCase().endsWith("STOP")) | |
l.add(e); | |
}, (l1, l2) -> { | |
if(l1.isEmpty() || !l1.get(l1.size()-1).toUpperCase().endsWith("STOP")) | |
l1.addAll(l2); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment