I'm trying to get around this, so some of you can help me. I have a list of files with their full paths (these are just lines that are on another computer), for example:
C:\a\b\c\file1.txt
C:\a\b\c\file2.txt
C:\a\d\file3.txt
C:\e\file4.txt
I want to create Jtree to show the directory structure as follows:
C:
a
b
c
file1.txt
file2.txt
d
file3.tct
e
file4.txt
I split the line on the separator, so I ended up with a list of arrays like:
"C:","a","b","c","file1.txt"
"C:","a","b","c","file2.txt"
"C:","a","d","file3.txt"
"C:","e","file4.txt"
Now I want to add an index to them at a time, but if the value already exists at that level, then go to the next index. that is, he will add the first array, and then to the second array, which will go at level 0 of the tree, "C:" already exists, so go to level 1 of the tree and index 1 of the array. The problems that I have is that I am not sure how to navigate the tree this way.
/ ?