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

7
LINES

< > BotCompany Repo | #1023744 // joinWithCommaOr - join with ", " separator, return alternative string when list is empty

JavaX fragment (include)

1  
static <A> S joinWithCommaOr(S def, Collection<A> c) {
2  
  ret nempty(c) ? joinWithComma(c) : def;
3  
}
4  
5  
static <A> S joinWithCommaOr(Collection<A> c, S def) {
6  
  ret joinWithCommaOr(def, c);
7  
}

Author comment

Began life as a copy of #1009156

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023744
Snippet name: joinWithCommaOr - join with ", " separator, return alternative string when list is empty
Eternal ID of this version: #1023744/4
Text MD5: 4cb34dfbf43d0a2f92bdd8e8a823071d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-01 20:03:28
Source code size: 189 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 252 / 304
Version history: 3 change(s)
Referenced in: [show references]