Here you can find the source of getHashMapFromArrayList( ArrayList
static public HashMap<String, String> getHashMapFromArrayList( ArrayList<String> lines, int keyIndex)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.HashMap; public class Main { static public HashMap<String, String> getHashMapFromArrayList( ArrayList<String> lines, int keyIndex) { HashMap<String, String> map = new HashMap<String, String>(); for (String line : lines) { String key = line.split(",")[keyIndex]; map.put(key, line);//from w w w. j av a2 s. com } return map; } }