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

12
LINES

< > BotCompany Repo | #1011692 // internPerProgram - intern a string in a program-held list

JavaX fragment (include)

1  
static WeakHashMap2 internPerProgram_map = new WeakHashMap2;
2  
3  
static S internPerProgram(S s) {
4  
  if (s == null) null;
5  
   synchronized(internPerProgram_map) {
6  
    WeakHashMap2.Entry<S, Bool> e = internPerProgram_map.getEntry(s);
7  
    S sym = e == null ? null : (S) e.get();
8  
    if (sym == null)
9  
      internPerProgram_map.put(sym = s, Bool.TRUE);
10  
    ret sym;
11  
  }
12  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011692
Snippet name: internPerProgram - intern a string in a program-held list
Eternal ID of this version: #1011692/3
Text MD5: 8e5545ffc0199a2d73f75d3aa0258dbe
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-03 17:26:54
Source code size: 376 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 419 / 474
Version history: 2 change(s)
Referenced in: [show references]