Java List to String convertListToString(List list)

Here you can find the source of convertListToString(List list)

Description

Transforms a list to a string which is passed to HSL API

License

Open Source License

Parameter

Parameter Description
list a parameter

Declaration

public static String convertListToString(List<?> list) 

Method Source Code


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

import java.util.List;

public class Main {
    /**//from ww  w  .j a  va2  s. co m
     * Transforms a list to a string which is passed to HSL API
     * 
     * @param list
     * @return 
     */
    public static String convertListToString(List<?> list) {
        String output = null;
        try {
            for (int i = 0; i < list.size(); i++) {
                if (i == 0)
                    output = list.get(i).toString();
                else
                    output += "|" + list.get(i).toString();
            }
            return output;
        } catch (NullPointerException e) {
            return null;
        }
    }
}

Related

  1. asStringList(Set attributes)
  2. convertListToStrArray(List list)
  3. convertListToString(Iterable l)
  4. convertListToString(List list)
  5. convertListToString(List list, String delimiter, char encloser)
  6. convertListToString(List data)
  7. convertListToString(List list, char delimiter, int estimatedLength)
  8. convertListToString(List dests)
  9. convertListToString(List itemList, String separator)

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