Java: How to create a Java tree, ordred by string path

Viewed 2876

I have a list of string path like this :

{"/foo", "/bar", "/foo/admin", "/foo/cust", "/bar/erp", "/bar/erp/call", "/foo/cust/profile"}

How to create an ordred string tree path? Or Where can I find a kind of library that can resolve my problems?

the other part, is that I want to know how to loop against the structure the fetch the informations that I need (e.g A tree node will contain a string path but can also contain a collection of object with a path attribute) so you can understand that a need a complex data structure

The tree can be represented like this:

- /
-- /foo
-- -- /foo/admin
-- -- /foo/cust
-- -- -- /foo/cust/profile
-- /bar
-- -- /bar/erp
-- -- -- /bar/erp/call

Thanks

3 Answers
Related