1 | static <A> LPair<A> overlappingPairs_lazy(L<A> l) { |
2 | if (l == null) null; |
3 | |
4 | class OverlappingPairs extends LazyList<Pair<A>> { |
5 | final int n = max(0, l(l)-1); |
6 | |
7 | public int size() { ret n; } |
8 | |
9 | public Pair<A> get(int i) { |
10 | ret pair(l.get(i), l.get(i+1)); |
11 | } |
12 | } |
13 | |
14 | ret new OverlappingPairs; |
15 | } |
Began life as a copy of #1014575
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: | #1026424 |
Snippet name: | overlappingPairs_lazy - lazy version of overlappingPairs |
Eternal ID of this version: | #1026424/4 |
Text MD5: | 4035de07069cf32cc0ec73864c81164f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-03 17:57:54 |
Source code size: | 334 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 238 / 265 |
Version history: | 3 change(s) |
Referenced in: | [show references] |