Here you can find the source of join(String s[], String glue)
Parameter | Description |
---|---|
s | a parameter |
glue | a parameter |
public static String join(String s[], String glue)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.Iterator; import java.util.List; public class Main { /**//from w ww.jav a2 s . co m * Join the given strings with given glue * * @param s * @param glue * @return String */ public static String join(String s[], String glue) { StringBuilder buffer = new StringBuilder(); List list = Arrays.asList(s); Iterator iterator = list.iterator(); while (iterator.hasNext()) { buffer.append(iterator.next()); if (iterator.hasNext()) buffer.append(glue); } return buffer.toString(); } }