Java ArrayList Join join(ArrayList list, String joinChar)

Here you can find the source of join(ArrayList list, String joinChar)

Description

join

License

Apache License

Declaration

private static String join(ArrayList<String> list, String joinChar) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

public class Main {
    private static String join(ArrayList<String> list, String joinChar) {
        StringBuilder sb = new StringBuilder();
        int i = 0;
        int size = list.size();
        for (String part : list) {
            i++;/*from   w  ww.  j  a  v a 2 s .c  o  m*/
            sb.append(part);
            if (i != size) {
                sb.append(joinChar);
            }
        }
        return sb.toString();
    }
}

Related

  1. join(ArrayList arr, String separator)
  2. Join(ArrayList coll, String delimiter)
  3. join(ArrayList list)
  4. join(ArrayList list, String delimiter)
  5. Join(ArrayList list, String delimiter)
  6. join(ArrayList nameList, String delimiter)
  7. join(ArrayList s, String delimiter)
  8. join(ArrayList strings, String separator)
  9. join(final ArrayList array, final String separator)