Libraryless. Click here for Pure Java version (3116L/19K).
static Map<S, LS> lcMergeStringsOccurringOnce(Map<S, LS> encodings) { new MultiSet<S> ms; for (LS l : values(encodings)) ms.addAll(l); ret mapValues(encodings, l -> { l = cloneList(l); int i = 0; while (i < l(l)-1) { int j = i; while (j < l(l) && ms.get(l.get(j)) == 1) ++j; if (j > i+1) replaceSublist(l, i, j, ll(joinSubList(l, i, j))); i++; } ret l; }); }
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: | #1028860 |
Snippet name: | lcMergeStringsOccurringOnce [for linecomp] |
Eternal ID of this version: | #1028860/2 |
Text MD5: | 768f0823b9f15cb9945e625b53ed4e55 |
Transpilation MD5: | 03a08e39b59831550f19c1dfb0609104 |
Author: | stefan |
Category: | javax / linecomp |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-10 14:15:30 |
Source code size: | 438 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 153 / 233 |
Version history: | 1 change(s) |
Referenced in: | [show references] |