sclass StrictHashMap<A, B> extends HashMap<A, B> {
bool detailedExceptions;
public B put(A key, B value) {
B v = get(key);
if (v != null && neq(v, value))
if (detailedExceptions)
fail("Strict map conflict: " + structure(key) + ", " + structure(get(key)) + ", " + structure(value));
else
fail("Trying to change strict map.");
ret super.put(key, value);
}
}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: | 1031 / 1573 |
| Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |