public static String join(String glue, Iterable<String> strings) { StringBuilder buf = new StringBuilder(); Iterator<String> i = strings.iterator(); if (i.hasNext()) { buf.append(i.next()); while (i.hasNext()) buf.append(glue).append(i.next()); } return buf.toString(); } public static String join(String glue, String[] strings) { return join(glue, Arrays.asList(strings)); }
Began life as a copy of #2000504
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #2000507 |
Snippet name: | join function + array version |
Eternal ID of this version: | #2000507/1 |
Text MD5: | 2cdb43a19ee4a2a133abe754f2721e3a |
Author: | stefan |
Category: | |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-09 16:15:10 |
Source code size: | 445 bytes / 14 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 619 / 1396 |
Referenced in: | [show references] |