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: | 621 / 1396 |
Referenced in: | #1000634 - Spike - find table names in MySQL dump #1000642 - Find create statements in MySQL dump #1000648 - Find field names in MySQL "create table" #1000810 - join function + array version #3000382 - Answer for ferdie (>> t = 1, f = 0) |