Libraryless. Click here for Pure Java version (13701L/78K).
static <MySSI extends AbstractSSI> L<MySSI> takeFirstNSSILines(int maxLines, Iterable<MySSI> l) { if (maxLines == Int.MAX_VALUE) ret asList(l); int sum = 0; new L<MySSI> out; fOr (ssi : l) { if (sum >= maxLines) break; int linesToCopy = min(ssi.height(), maxLines-sum); if (linesToCopy < ssi.height()) break; out.add(ssi); //out.add(linesToCopy == ssi.height() ? ssi : ssi.topPart(linesToCopy)); sum += ssi.height(); } ret out; }
Began life as a copy of #1035613
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035616 |
Snippet name: | takeFirstNSSILines |
Eternal ID of this version: | #1035616/8 |
Text MD5: | 9608f7b2ac6079adad90404933299966 |
Transpilation MD5: | 1b9970d5c91641261e80c8f2a7fa7619 |
Author: | stefan |
Category: | javax / gazelle 22 |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-07-19 22:08:16 |
Source code size: | 484 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 133 / 217 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1035752 - CutListToBudget |