List<String> (@NotNull String path, char separatorChar) { List<String> list = new ArrayList<>(); int index = 0; int nextSeparator; while ((nextSeparator = path.indexOf(separatorChar, index)) != -1) { list.add(path.substring(index, nextSeparator)); index = nextSeparator + 1; } list.add(path.substring(index)); return list; }