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

9
LINES

< > BotCompany Repo | #1011694 - classForName - cached version of Class.forName; should be a lot faster

JavaX fragment (include)

static Map<S, Class> classForName_cache = synchroHashMap();

static Class classForName(S name) ctex {
  if (classForName_cache == null) ret Class.forName(name); // in class init
  Class c = classForName_cache.get(name);
  if (c == null)
    classForName_cache.put(name, c = Class.forName(name));
  ret c;
}

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1011694
Snippet name: classForName - cached version of Class.forName; should be a lot faster
Eternal ID of this version: #1011694/5
Text MD5: 4eed33bc2825b5d6ca99a895f989212f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-22 22:47:44
Source code size: 314 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 317 / 316
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1011694 & http://1011694.tinybrain.de