Java List Join join(final List list, final String sepa)

Here you can find the source of join(final List list, final String sepa)

Description

join

License

BSD License

Declaration

static String join(final List<String> list, final String sepa) 

Method Source Code

//package com.java2s;
/**//  w  w  w  . j a  v a2s.  c  o m
 * Copyright (C) 2010-2012 Andrei Pozolotin <Andrei.Pozolotin@gmail.com>
 *
 * All rights reserved. Licensed under the OSI BSD License.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */

import java.util.List;

public class Main {
    static String join(final List<String> list, final String sepa) {

        final StringBuilder text = new StringBuilder(256);

        final int size = list.size();

        for (int k = 0; k < size; k++) {
            text.append(list.get(k));
            if (k == size - 1) {
                break;
            }
            text.append(sepa);
        }

        return text.toString();

    }
}

Related

  1. join(final List things, final String on)
  2. join(final List list, final String delimiter)
  3. join(final List array, final String separator)
  4. join(final List data, String separator)
  5. join(final List list)
  6. join(final List path, final char delimiter)
  7. join(final List strings, final String delimiter)
  8. join(final List strings, final String separator)
  9. join(final List substrings, final String join)

  10. HOME | Copyright © www.java2s.com 2016