Java Array to String arrayToString(Object[] objects)

Here you can find the source of arrayToString(Object[] objects)

Description

array To String

License

Apache License

Declaration

public static String arrayToString(Object[] objects) 

Method Source Code


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

import java.util.ArrayList;
import java.util.Arrays;

import java.util.List;

public class Main {
    public static String arrayToString(Object[] objects) {
        List<Object> x = newList();
        x.addAll(Arrays.asList(objects));
        return x.toString();
        /*//from   ww  w .  ja  v  a2  s .  c o m
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for(Object o:objects){
           if(o==null){
        sb.append("null");
           } else {
        sb.append(o.getClass().getName());
        sb.append("("+o+")");
           }
           sb.append(":");
        }
        sb.append("]");
        return sb.toString();*/
    }

    public static <T> List<T> newList() {
        return new ArrayList<T>();
    }
}

Related

  1. arrayToString(Object[] array, String split)
  2. arrayToString(Object[] ary)
  3. arrayToString(Object[] list)
  4. arrayToString(Object[] objects)
  5. arrayToString(Object[] objects)
  6. arrayToString(Object[] objects)
  7. arrayToString(Object[] objs)
  8. arrayToString(Object[] objs)
  9. arrayToString(Object[] objs, boolean stripPackageNames)