Libraryless. Click here for Pure Java version (4685L/26K).
static <A> LPair<IntRange, A> streaksOfRepeatingElements(L<A> l) { new LPair<IntRange, A> out; int i = 0, n = l(l); while (i < n) { A a = l.get(i); int j = i+1; while (j < n && eq(a, l.get(j))) ++j; out.add(pair(intRange(i, j), a)); i = j; } ret out; }
Began life as a copy of #1011014
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033726 |
| Snippet name: | streaksOfRepeatingElements |
| Eternal ID of this version: | #1033726/3 |
| Text MD5: | d567132f1da3263e4ca6535c5a5334e7 |
| Transpilation MD5: | b502380efcbbb2e32fd0a311a7e9cf2f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-12-30 22:01:13 |
| Source code size: | 293 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 412 / 510 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |