Response title
This is preview!




Click on Join Now to Sign Up

// Let say it is the result of loadStrings() String[] loadStringResult = { "Alpha,Beta,Gamma", // Header "Blue,France,42", // Stupid data "Red,China,8", }; HashMap<String, ArrayList<String>> data = new HashMap<String, ArrayList<String>>(); // Process header String[] headers = split(loadStringResult[0], ","); for (String header : headers) // For each header name { // Create an entry in the hash map with a fresh new array list data.put(header, new ArrayList<String>()); } for (int i = 1; i < loadStringResult.length; i++) // Note I start at 1 { String[] items = split(loadStringResult[i], ","); int n = 0; for (String item : items) // For each column { // Get the nth header and use it to fetch the corresponding list ArrayList<String> column = data.get(headers[n++]); column.add(item); } } // Get a sample ArrayList<String> x = data.get(headers[1]); println(x); exit();