algorithm - Java Tries : Need a better approach -
          this question has answer here:                               what nullpointerexception, , how fix it?                                         12 answers                                          i new tries , testing how works. right building contact list. add 'prashanth' , 'pradep' trie , when search 'pra' should receive count two. approach having variable size  in each node , returning when string of same length found. there unnecessary things/variables payload etc used debugging. problem found when store character , node in hashmap, empty node getting stored. getting 0 answer time.    public class tries {  public static class node {      hashmap<character, node> children = new hashmap<>();     boolean endofword = false;     int size =0;     int payload = 10;       public void setnode(char c, node n) {       children.put(c,n);     }      public node getnode(char c) {         return children.get(c);     }      public void addnode( string s,...