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

15
LINES

< > BotCompany Repo | #1008777 // StringTree2

JavaX fragment (include)

sclass StringTree2<A> {
  A leafValue;
  HashMap<S, StringTree2<A>> children = new HashMap;
  
  A get() { ret leafValue; }

  StringTree2<A> get(S s) { ret children.get(s); }
  
  StringTree2<A> getOrAdd(S s) {
    StringTree2<A> t = children.get(s);
    if (t == null)
      children.put(s, t = new StringTree2);
    ret t;
  }
}

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: 623 / 1280
Version history: 4 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)