(String word)
| 24 | |
| 25 | //helper method |
| 26 | public Node getLast(String word) { |
| 27 | Node curr = root; |
| 28 | for (char x : word.toCharArray()) { |
| 29 | if (curr.children[x - 'a'] == null) { |
| 30 | return null; |
| 31 | } |
| 32 | |
| 33 | curr = curr.children[x - 'a']; |
| 34 | } |
| 35 | return curr; |
| 36 | } |
| 37 | |
| 38 | public boolean startsWith(String prefix) { |
| 39 | Node res = getLast(prefix); |
no outgoing calls
no test coverage detected