I\'ve a list of paths like this
/mnt/sdcard/folder1/a/b/file1
/mnt/sdcard/folder1/a/b/file2
/mnt/sdcard/folder1/a/b/file3
/mnt/sdcard/folder1/a/b/file4
/mnt/sdc
Seems like you could adapt either a Trie / Radix Trie or a Binary Search Tree to work in either situation. You could augment a Trie to store "folders" as the inner nodes (instead of characters like in a regular Trie) or you could augment a Binary Search Tree to store "folders" as inner nodes (as long as they implement a comparable interface) and "files" as leaf nodes.
My implementation of those structures are linked in the text above.