Libraryless. Click here for Pure Java version (2153L/14K).
// returns empty first and empty last static <A> LL<A> splitAtListElement_multi(L<A> l, A splitter) { l = unnull(l); new LL<A> parts; int i = 0; while true { int j = indexOf(l, splitter, i); if (j < 0) { parts.add(subList(l, i)); break; } parts.add(subList(l, i, j)); i = j+1; while (i < l(l) && eq(l.get(i), splitter)) ++i; } ret parts; }
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: | #1006143 |
Snippet name: | splitAtListElement_multi - split list at (possibly repeating) occurrences of a splitter element |
Eternal ID of this version: | #1006143/3 |
Text MD5: | cace7ba55ff6d2b88523d99b2d719a62 |
Transpilation MD5: | e3b0ae722ccb2d90b1bef5169b7721a8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-13 17:49:38 |
Source code size: | 403 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 550 / 632 |
Version history: | 2 change(s) |
Referenced in: | #1006144 - splitBitsAtElement #1006654 - Standard functions list 2 (LIVE, continuation of #761) |