Skip to content

Instantly share code, notes, and snippets.

@amaembo
Created August 30, 2015 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amaembo/0bc8e982d179f2e45d7a to your computer and use it in GitHub Desktop.
Save amaembo/0bc8e982d179f2e45d7a to your computer and use it in GitHub Desktop.
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