mardi 31 mars 2015

Java String-Collection: Longest common prefixes

I got a collection of String (directory paths). How can I get the longest common prefixes of ALL strings?


Example: ["e:/users/test", "e:/users/test/abc/", "c:/programs", "e:/data", "/test"]


the solution has to be than: ["e:/", "c:/programs", "/test"]


I have no idea how to realize this ...


thanks for your help, greetings


Aucun commentaire:

Enregistrer un commentaire