Java List Join join(List list)

Here you can find the source of join(List list)

Description

join

License

Open Source License

Declaration

public static String join(List<?> list) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    private static final char COMMA = ',';

    public static String join(List<?> list) {
        StringBuilder sb = new StringBuilder();
        if (list != null) {
            int size = list.size();
            if (size > 0) {
                sb.append(list.get(0));//from ww  w  .  j av a2s.c  om
            }
            for (int i = 1; i < size; i++) {
                sb.append(COMMA).append(list.get(i));
            }
        }
        return sb.toString();
    }
}

Related

  1. join(List list, T element)
  2. join(List _items, String _delim)
  3. join(List arr, String seperator)
  4. join(List items, char separator)
  5. join(List items, String delimiter)
  6. join(List list, String delim)
  7. join(List list, String sep)
  8. join(List objects, String delimiter)
  9. join(List parts)