Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1021957 // takeFirst_lazy function (take first n elements of a list; use standard .subList)

JavaX fragment (include)

static <A> L<A> takeFirst_lazy(L<A> l, int n) {
  ret l(l) <= n ? l : subList(l, 0, n);
}

static <A> L<A> takeFirst_lazy(int n, L<A> l) {
  ret takeFirst_lazy(l, n);
}

static <A> L<A> takeFirst_lazy(int n, Iterable<A> i) {
  ret takeFirst(n, i);
}

Author comment

Began life as a copy of #1007549

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021957
Snippet name: takeFirst_lazy function (take first n elements of a list; use standard .subList)
Eternal ID of this version: #1021957/1
Text MD5: 9ac7ede01545fcc692687f38ea34fd21
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 10:29:24
Source code size: 261 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 228 / 265
Referenced in: [show references]