Here you can find the source of convertArray(Object columns[], int minLength)
Parameter | Description |
---|---|
columns | columns to return |
minLength | minimum number of columns in return array |
public static String[] convertArray(Object columns[], int minLength)
//package com.java2s; /*// w w w .j a v a 2 s . c om * This file is part of CSV package. * * CSV is free software: you can redistribute it * and/or modify it under the terms of version 3 of the GNU * Lesser General Public License as published by the Free Software * Foundation. * * CSV is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with CSV. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. */ public class Main { /** * Returns an array from the columns. * This function exists for convinience to take care of minimum column count. * @param columns columns to return * @param minLength minimum number of columns in return array * @return arrray with column values */ public static String[] convertArray(Object columns[], int minLength) { int colcount = minLength > 0 ? minLength : 0; if (columns != null) colcount = columns.length; String rc[] = new String[Math.max(colcount, minLength)]; if (colcount > 0) { for (int i = 0; i < colcount; i++) { rc[i] = columns[i] != null ? columns[i].toString() : null; } } return rc; } }