Java Array to String toDelimitedString(Object[] array, String delimiter)

Here you can find the source of toDelimitedString(Object[] array, String delimiter)

Description

to Delimited String

License

Open Source License

Declaration

public static String toDelimitedString(Object[] array, String delimiter) 

Method Source Code

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

import java.util.Arrays;
import java.util.Iterator;

public class Main {
    public static String toDelimitedString(Object[] array, String delimiter) {
        return createDelimitedString(Arrays.asList(array), delimiter);
    }//from   w  ww.j a  v a  2s .  c o  m

    public static String createDelimitedString(Iterable iterable, String delimiter) {
        Iterator iter = iterable.iterator();
        String string = "";
        while (iter.hasNext()) {
            string += iter.next();
            if (iter.hasNext())
                string += delimiter;
        }
        return string;

    }
}

Related

  1. intToString(int[] vectorIndex)
  2. permChangeToString(int[] permutation)
  3. stringify(int arr[])
  4. stringify(int[] raw)
  5. toDelimitedString(Object[] array, String delimiter)
  6. toPrettyString(String[] array)
  7. toString(byte[] array)
  8. toString(Class aClass, Object[] objects)
  9. toString(Class[] modelPath)