I have a List of n Paths and i want to create a Hierarchy ( Tree structure with objects ) out of them.
E.g. Paths :
/src/main/java/tools/mockfile/generator/data/RecordPart.java
/src/main/java/tools/mockfile/generator/Analyzer.java
/src/main/java/tools/mockfile/test/Menu.java
...
small Hierarchy :
mockfile
├── generator
│ ├── data
│ │ └── RecordPart.java
│ └── Analyzer.java
└── test
├── Menu.java
└── ...
Is there any Library or Method who could help me to sort the paths to a hierarchy ? Or is the only way to split the Strings and compare all Parts and build my own Hierarchy?