1 | sclass StrictHashMap<A, B> extends HashMap<A, B> { |
2 | bool detailedExceptions; |
3 | |
4 | public B put(A key, B value) { |
5 | B v = get(key); |
6 | if (v != null && neq(v, value)) |
7 | if (detailedExceptions) |
8 | fail("Strict map conflict: " + structure(key) + ", " + structure(get(key)) + ", " + structure(value)); |
9 | else |
10 | fail("Trying to change strict map."); |
11 | ret super.put(key, value); |
12 | } |
13 | } |
Began life as a copy of #1003482
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: | #1005172 |
Snippet name: | StrictHashMap - non-overwrite HashMap (doesn't allow modification, only adding) |
Eternal ID of this version: | #1005172/1 |
Text MD5: | adb59c89aa4e525616717313ea92eb2d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-18 19:33:51 |
Source code size: | 416 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 585 / 1137 |
Referenced in: | [show references] |