Libraryless. Click here for Pure Java version (3805L/22K).
static Map<S, Class> classForName_cache = synchroHashMap(); static Class classForName(S name, O classFinder default null) { // first clause is when we're in class init if (classForName_cache == null || classFinder != null) ret classForName_uncached(name, classFinder); Class c = classForName_cache.get(name); if (c == null) classForName_cache.put(name, c = classForName_uncached(name, null)); ret c; } static Class classForName_uncached(S name, O classFinder) ctex { if (classFinder != null) ret (Class) callF(classFinder, name); ret Class.forName(name); }
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: | #1011694 |
Snippet name: | classForName - cached version of Class.forName; should be a lot faster |
Eternal ID of this version: | #1011694/8 |
Text MD5: | 13b538239b0b860a60558324cf5edb84 |
Transpilation MD5: | 248ca98b9a9dd81a41d090b6248b6489 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-12 01:20:50 |
Source code size: | 595 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 616 / 725 |
Version history: | 7 change(s) |
Referenced in: | [show references] |