Java Collection to String collectionToString(Collection list)

Here you can find the source of collectionToString(Collection list)

Description

collection To String

License

LGPL

Declaration

public static String collectionToString(Collection<?> list) 

Method Source Code


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

import java.util.*;

public class Main {
    public static String collectionToString(Collection<?> list) {
        if (null == list) {
            return null;
        }/*from www .  ja v a  2 s.c  om*/
        final StringBuilder sb = new StringBuilder();
        for (final Object item : list) {
            if (null != item) {
                sb.append(item.toString());
            }
        }
        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. collectionToString(Collection coll, String connectSymbol)
  2. collectionToString(Collection collection, String separator)
  3. collectionToString(Collection collection, String separator)
  4. collectionToString(Collection elements)
  5. collectionToString(Collection list)
  6. collectionToString(Collection collection, String prefix)
  7. collectionToString(Collection collection)
  8. collectionToString(Collection collection)
  9. collectionToString(Collection collection)

  10. HOME | Copyright © www.java2s.com 2016