1 | public static String join(String glue, Iterable<String> strings) { |
2 | StringBuilder buf = new StringBuilder(); |
3 | Iterator<String> i = strings.iterator(); |
4 | if (i.hasNext()) { |
5 | buf.append(i.next()); |
6 | while (i.hasNext()) |
7 | buf.append(glue).append(i.next()); |
8 | } |
9 | return buf.toString(); |
10 | } |
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: | #2000504 |
Snippet name: | join function |
Eternal ID of this version: | #2000504/1 |
Text MD5: | 90ff8a0580f06573e208950b92da1b84 |
Author: | stefan |
Category: | |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-09 02:41:48 |
Source code size: | 324 bytes / 10 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 705 / 170 |
Referenced in: | [show references] |