Construct a Trie from a string, where '/' is the separator. s @param str @return
(String str)
| 252 | * @return |
| 253 | */ |
| 254 | public static Trie fromString(String str) { |
| 255 | String[] components = str.split("/"); |
| 256 | Trie r = ROOT; |
| 257 | for(int i=0;i!=components.length;++i) { |
| 258 | r = r.append(components[i]); |
| 259 | } |
| 260 | return r; |
| 261 | } |
| 262 | |
| 263 | public static Trie fromStrings(String... components) { |
| 264 | Trie r = ROOT; |