Here you can find the source of join(Iterable extends Object> joinee, String joiner)
public static String join(Iterable<? extends Object> joinee, String joiner)
//package com.java2s; /*/* www .j a v a 2s. c om*/ * Copyright (c) 2015 Zachary Rauen * Website: www.ZackRauen.com * * All rights reserved. Use is subject to license terms. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * If a copy of the License is not provided with the work, you may * obtain a copy at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.Iterator; public class Main { public static String join(Iterable<? extends Object> joinee, String joiner) { String returnMe = ""; Iterator<? extends Object> iterator = joinee.iterator(); while (iterator.hasNext()) { returnMe += iterator.next().toString(); if (iterator.hasNext()) returnMe += joiner; } return returnMe; } }