Libraryless. Click here for Pure Java version (3016L/19K).
// the result indices are kind of nonsensical; we should make new pairs instead static Map<S, L<Int>> lcRenumberTopLevelEncodings_simplify(Map<S, L<Int>> encodings) { new MultiSet<Int> ms; for (L<Int> l : values(encodings)) ms.addAll(l); new LinkedHashMap<S, L<Int>> out; for (S file, L<Int> l : encodings) { new L<Int> l2; for i over l: { if (i > 0 && ms.get(l.get(i-1)) == 1 && ms.get(l.get(i)) == 1) continue; l2.add(l.get(i)); } out.put(file, l2); } ret out; }
Began life as a copy of #1028771
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028772 | 
| Snippet name: | lcRenumberTopLevelEncodings_simplify - simplify pairs of items appearing only once to a single item | 
| Eternal ID of this version: | #1028772/4 | 
| Text MD5: | 0e75603099c911c332161ce2bb927687 | 
| Transpilation MD5: | 84c67f35555c9c3c197b687af6fc4bcb | 
| Author: | stefan | 
| Category: | javax / parsing | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-07-08 01:21:22 | 
| Source code size: | 536 bytes / 18 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 381 / 515 | 
| Version history: | 3 change(s) | 
| Referenced in: | [show references] |