Here you can find the source of getFixedArrayListSizeFromCSV(String csvString, int returnArrayListSize)
static public ArrayList<String> getFixedArrayListSizeFromCSV(String csvString, int returnArrayListSize)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; public class Main { static final public String CSV_SEPARATOR = ","; static public ArrayList<String> getFixedArrayListSizeFromCSV(String csvString, int returnArrayListSize) { ArrayList<String> returnArray = getArrayListFromCSV(csvString); while (returnArray.size() < returnArrayListSize) returnArray.add(""); return returnArray; }/* w ww . j a v a 2 s.c o m*/ static public ArrayList<String> getArrayListFromCSV(String csvString) { return helper1(csvString, CSV_SEPARATOR); } static private ArrayList<String> helper1(String ssvString, String separator) { if (ssvString.isEmpty()) return new ArrayList<>(); // Return list with 0 elements as it should be! return new ArrayList<String>(Arrays.asList(ssvString.split(separator))); } }