Libraryless. Click here for Pure Java version (7976L/45K).
1 | static <A> ItIt<A> takeFirstI(int n, Iterator<A> i) { |
2 | ret i == null ? null : iff(new F0 { |
3 | int remaining = n; |
4 | |
5 | O get() { |
6 | ret remaining-- <= 0 || !i.hasNext() ? endMarker() : i.next(); |
7 | } |
8 | }); |
9 | } |
Began life as a copy of #1024189
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024814 |
Snippet name: | takeFirstI - cut off iterator after certain number of elements returned |
Eternal ID of this version: | #1024814/4 |
Text MD5: | b456f150ec0306fa9aac82546ffe4bb1 |
Transpilation MD5: | 7f1968d004c91ac042db906f22d0b11c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-26 12:23:25 |
Source code size: | 224 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 262 / 370 |
Version history: | 3 change(s) |
Referenced in: | [show references] |