class StringHelper {

    public static List<String> getSubPhrases(String string) {
        Validate.notNull(string, "string must not be null");
        List<String> phrases = new ArrayList<>();
        String[] split = string.split("\\s");
        for (int i = 0; i < split.length; i++) {
            for (int j = i; j < split.length; j++) {
                StringBuilder phrase = new StringBuilder();
                for (int idx = i; idx <= j; idx++) {
                    if (phrase.length() > 0) {
                        phrase.append(' ');
                    }
                    phrase.append(split[idx]);
                }
                String subphrase = phrase.toString();
                if (subphrase.length() > 0) {
                    phrases.add(subphrase);
                }
            }
        }
        return phrases;
    }

    private  StringHelper();

}