1 | // remove : voidfunc(K) |
2 | static <K> LinkedHashMap<K, Long> expiringHelperMap(final int timeOut, fO remove) {
|
3 | ret new LinkedHashMap<K, Long>() {
|
4 | protected bool removeEldestEntry(Map.Entry<K, Long> eldest) {
|
5 | long time = now(); |
6 | if (time - eldest.getValue() > timeOut) {
|
7 | Iterator<Map.Entry<K, Long>> i = entrySet().iterator(); |
8 | Map.Entry<K, Long> e = i.next(); |
9 | do {
|
10 | i.remove(); |
11 | pcallF(remove, e.getKey()); |
12 | } while (i.hasNext() && time - (e = i.next()).getValue() > timeOut); |
13 | } |
14 | false; |
15 | } |
16 | }; |
17 | } |
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: | #1010798 |
| Snippet name: | expiringHelperMap |
| Eternal ID of this version: | #1010798/5 |
| Text MD5: | 770b44ddedeadd500ef659546d213e2d |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-10-03 18:52:50 |
| Source code size: | 592 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 678 / 710 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |