Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1008777 // StringTree2

JavaX fragment (include)

1  
sclass StringTree2<A> {
2  
  A leafValue;
3  
  HashMap<S, StringTree2<A>> children = new HashMap;
4  
  
5  
  A get() { ret leafValue; }
6  
7  
  StringTree2<A> get(S s) { ret children.get(s); }
8  
  
9  
  StringTree2<A> getOrAdd(S s) {
10  
    StringTree2<A> t = children.get(s);
11  
    if (t == null)
12  
      children.put(s, t = new StringTree2);
13  
    ret t;
14  
  }
15  
}

Author comment

Began life as a copy of #1008648

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008777
Snippet name: StringTree2
Eternal ID of this version: #1008777/5
Text MD5: a62c25c62608502cfe99b01a08392e55
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-06 06:41:18
Source code size: 345 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 624 / 1281
Version history: 4 change(s)
Referenced in: [show references]