I have got a package name, its value is com.foo.bar.my.app. I want to create the directories under src/main/test if any of the directory in the dot-based string package name does not exists.
I know I can achieve this by split each of the directory name:
String pkgName = "com.foo.bar.my.app";
String[] dirs = pkgName.split(".");
Then create File object for each directory name and use File#exists() api to check and create new file if not exists.
But is there a more concise elegant way to achieve it in Java 8 ?