Java Array Join join(Object[] array)

Here you can find the source of join(Object[] array)

Description

join

License

Open Source License

Declaration

public static String join(Object[] array) 

Method Source Code

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

import java.util.List;

public class Main {
    public static String join(List<?> list) {
        return join(list.toArray());
    }/*from w ww  .  j a va  2s  .c om*/

    public static String join(List<?> list, String separator) {
        return join(list.toArray(), separator);
    }

    public static String join(Object[] array) {
        return join(array, ", ");
    }

    public static String join(Object[] array, String separator) {
        if (array.length == 0)
            return "";

        String result = array[0].toString();

        for (int index = 1; index < array.length; index++)
            result += separator + array[index];

        return result;
    }
}

Related

  1. join(Object[] arguments)
  2. join(Object[] arr)
  3. join(Object[] arr, String separator)
  4. join(Object[] arr, String separator)
  5. join(Object[] array)
  6. join(Object[] array)
  7. join(Object[] array)
  8. join(Object[] array)
  9. join(Object[] array, char separator)