Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@xrrocha
Created March 5, 2018 00:01
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 xrrocha/852bbad457f945490f770e7408f00813 to your computer and use it in GitHub Desktop.
Save xrrocha/852bbad457f945490f770e7408f00813 to your computer and use it in GitHub Desktop.
static List<WordSplit> splits(String word) {
return IntStream
.rangeClosed(0, word.length()).boxed()
.map(i -> {
String left = word.substring(0, i);
String right = word.substring(i);
return new WordSplit(left, right);
})
.collect(toList());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment