Java Iterable Join join(Iterable joinee, String joiner)

Here you can find the source of join(Iterable joinee, String joiner)

Description

join

License

Open Source License

Declaration

public static String join(Iterable<? extends Object> joinee, String joiner) 

Method Source Code

//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;
    }
}

Related

  1. join(final String delimiter, final Iterable objs)
  2. join(Iterable elements, String delimiter)
  3. join(Iterable iterable, String delimiter)
  4. join(Iterable s, String delimiter)
  5. join(Iterable iterable, String delimiter)
  6. join(Iterable c, String delimeter)
  7. join(Iterable elements, String separator)
  8. join(Iterable elements, String separator)
  9. join(Iterable elements, String separator)