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

19
LINES

< > BotCompany Repo | #1007610 - popFirst - remove & return first element(s) of collection

JavaX fragment (include)

static <A> A popFirst(L<A> l) {
  if (empty(l)) null;
  A a = first(l);
  l.remove(0);
  ret a;
}

static <A> A popFirst(Collection<A> l) {
  if (empty(l)) null;
  A a = first(l);
  l.remove(a);
  ret a;
}

static <A> L<A> popFirst(int n, L<A> l) {
  L<A> part = cloneSubList(l, 0, n);
  removeSubList(l, 0, n);
  ret part;
}

Author comment

Began life as a copy of #1002780

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007610
Snippet name: popFirst - remove & return first element(s) of collection
Eternal ID of this version: #1007610/6
Text MD5: e609ed8d07a99aca08706d5099729f5e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-25 18:42:06
Source code size: 343 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 392 / 390
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1007610 & http://1007610.tinybrain.de