Java Array to String arrayToString(final Object[] arr)

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

Description

array To String

License

LGPL

Declaration

public static String arrayToString(final Object[] arr) 

Method Source Code


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

import java.util.*;

public class Main {
    public static String arrayToString(final Object[] arr) {
        if (arr == null) {
            return "";
        }//w ww  .j  a v  a  2 s.c o m

        final StringBuilder sb = new StringBuilder();
        for (final Object item : arr) {
            sb.append(item);
        }
        return sb.toString();
    }

    public static String toString(final Collection list) {
        final StringBuilder sb = new StringBuilder();
        if (null != list) {
            for (final Object item : list) {
                if (null != item) {
                    sb.append(item);
                }
            }
        }
        return sb.toString();
    }

    public static String toString(final Object[] list) {
        final StringBuilder sb = new StringBuilder();
        if (null != list) {
            for (final Object item : list) {
                if (null != item) {
                    sb.append(item);
                }
            }
        }
        return sb.toString();
    }
}

Related

  1. arrayToString(double[] xs)
  2. arrayToString(final byte[] array)
  3. arrayToString(final byte[] array, final int start, final int length)
  4. arrayToString(final float[] array)
  5. arrayToString(final Object[] a)
  6. arrayToString(final Object[] array)
  7. arrayToString(final Object[] array)
  8. arrayToString(final String[] args)
  9. arrayToString(final String[] strs)