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

11
LINES

< > BotCompany Repo | #1012066 // concatLists_conservative - use any of the lists verbatim if the others are empty

JavaX fragment (include)

static <A> L<A> concatLists_conservative(L<A> a, L<A> b) {
  if (empty(a)) ret b;
  if (empty(b)) ret a;
  ret concatLists(a, b);
}

static <A> L<A> concatLists_conservative(Collection<A> a, Collection<A> b) {
  if (empty(a) && b instanceof L) ret b/L;
  if (empty(b) && a instanceof L) ret a/L;
  ret concatLists(a, b);
}

Author comment

Began life as a copy of #1001241

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012066
Snippet name: concatLists_conservative - use any of the lists verbatim if the others are empty
Eternal ID of this version: #1012066/3
Text MD5: 743165585531a1441ec431eb5a7b9c94
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 11:32:05
Source code size: 332 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 444
Version history: 2 change(s)
Referenced in: [show references]