Java Array to String arrayToString(T[] items, String delimiter)

Here you can find the source of arrayToString(T[] items, String delimiter)

Description

Pretty print an array of objects of type T

License

Open Source License

Parameter

Parameter Description
seq a parameter

Return

delimited list

Declaration

public static <T> String arrayToString(T[] items, String delimiter) 

Method Source Code

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

public class Main {
    /**/*from  www .  j a  v  a2s .c o m*/
     * Pretty print an array of objects of type T
     * @param seq
     * @return delimited list
     */
    public static <T> String arrayToString(T[] items, String delimiter) {
        if (null == items) {
            return "null";
        }
        StringBuilder buf = new StringBuilder();
        for (T cur : items) {
            if (buf.length() > 0) {
                buf.append(delimiter);
            }
            buf.append(cur.toString());
        }

        return buf.toString();
    }
}

Related

  1. arrayToString(T[] array)
  2. arrayToString(T[] array)
  3. arrayToString(T[] array)
  4. arrayToString(T[] array)
  5. arrayToString(T[] array, CharSequence start, CharSequence end)
  6. arrayToString2D(String title, String innerTitle, double[][] vect)
  7. arrayToStringArray(boolean[] values)
  8. arrayToStringDelimited(final String[] array, final String delimiter)
  9. arrayToStringNullable(String[] a)