Java Iterable Join join(final CharSequence sep, final Iterable src)

Here you can find the source of join(final CharSequence sep, final Iterable src)

Description

join

License

Open Source License

Declaration

@Deprecated
public static String join(final CharSequence sep, final Iterable<?> src) 

Method Source Code

//package com.java2s;
/**// www  .  ja  v a  2  s. com
 * Copyright (C) 2013
 * by 52 North Initiative for Geospatial Open Source Software GmbH
 *
 * Contact: Andreas Wytzisk
 * 52 North Initiative for Geospatial Open Source Software GmbH
 * Martin-Luther-King-Weg 24
 * 48155 Muenster, Germany
 * info@52north.org
 *
 * This program is free software; you can redistribute and/or modify it under
 * the terms of the GNU General Public License version 2 as published by the
 * Free Software Foundation.
 *
 * This program is distributed WITHOUT ANY WARRANTY; even without the implied
 * WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program (see gnu-gpl v2.txt). If not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA or
 * visit the Free Software Foundation web page, http://www.fsf.org.
 */

import java.util.Arrays;
import java.util.Iterator;

public class Main {
    /**
     * @deprecated use {@link Joiner}.
     */
    @Deprecated
    public static StringBuffer join(final CharSequence sep,
            final StringBuffer buff, final Iterable<?> src) {
        final Iterator<?> it = src.iterator();
        if (it.hasNext()) {
            buff.append(it.next());
        }
        while (it.hasNext()) {
            buff.append(sep).append(it.next());
        }
        return buff;
    }

    /**
     * @deprecated use {@link Joiner}.
     */
    @Deprecated
    public static String join(final CharSequence sep, final Iterable<?> src) {
        return join(sep, new StringBuffer(), src).toString();
    }

    /**
     * @deprecated use {@link Joiner}.
     */
    @Deprecated
    public static StringBuffer join(final CharSequence sep,
            final StringBuffer buff, final Object... src) {
        return join(sep, buff, Arrays.asList(src));
    }

    /**
     * @deprecated use {@link Joiner}.
     */
    @Deprecated
    public static String join(final CharSequence sep, final Object... src) {
        return join(sep, Arrays.asList(src));
    }
}

Related

  1. join(CharSequence delimiter, Iterable tokens)
  2. join(CharSequence delimiter, Iterable tokens)
  3. join(CharSequence delimiter, Iterable elements)
  4. join(CharSequence separator, Iterable strings)
  5. join(final Iterable elements, final String separator)
  6. join(final Iterable iterable, final CharSequence separator)
  7. join(final Iterable objects, final CharSequence separator)
  8. join(final Iterable tokens, final String delimiter)