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)

1  
static <A> L<A> concatLists_conservative(L<A> a, L<A> b) {
2  
  if (empty(a)) ret b;
3  
  if (empty(b)) ret a;
4  
  ret concatLists(a, b);
5  
}
6  
7  
static <A> L<A> concatLists_conservative(Collection<A> a, Collection<A> b) {
8  
  if (empty(a) && b instanceof L) ret b/L;
9  
  if (empty(b) && a instanceof L) ret a/L;
10  
  ret concatLists(a, b);
11  
}

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: 504 / 525
Version history: 2 change(s)
Referenced in: [show references]