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

10
LINES

< > BotCompany Repo | #1015400 // classForNameOpt - null if not found, always fast

JavaX fragment (include)

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

static Class classForNameOpt(S name) ctex {
  if (classForNameOpt_cache.containsKey(name))
    ret classForNameOpt_cache.get(name);
  Class c = null;
  try { c = Class.forName(name); } catch {}
  classForNameOpt_cache.put(name, c);
  ret c;
}

Author comment

Began life as a copy of #1011694

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: #1015400
Snippet name: classForNameOpt - null if not found, always fast
Eternal ID of this version: #1015400/2
Text MD5: 6562131c86617ee9b9367f4cf99b1a1e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-25 15:36:43
Source code size: 315 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 465 / 496
Version history: 1 change(s)
Referenced in: [show references]