sclass SnippetTitles { Map<Long, S> titles = synchroHashMap(); S get(S snippetID) { if (snippetID == null) null; long id = parseSnippetID(snippetID); if (titles.containsKey(id)) ret titles.get(id); else { S title = getSnippetTitle_safe(snippetID); titles.put(id, title); ret title; } } // like get, but only check the cache S probe(S id) { ret titles.get(parseSnippetID(id)); } // advanced uses void put(S id, S title) { titles.put(parseSnippetID(id), title); } bool has(S id) { ret titles.containsKey(parseSnippetID(id)); } void clear() { titles.clear(); } }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006320 |
Snippet name: | SnippetTitles - cache for snippet titles |
Eternal ID of this version: | #1006320/6 |
Text MD5: | dc7068e73384edf50d14f5841bc17a67 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-07 01:34:40 |
Source code size: | 688 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 658 / 1510 |
Version history: | 5 change(s) |
Referenced in: | [show references] |