-
-
Save xrrocha/852bbad457f945490f770e7408f00813 to your computer and use it in GitHub Desktop.
This file contains 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
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