Java HashMap Create getHashMapFromArrayList( ArrayList lines, int keyIndex)

Here you can find the source of getHashMapFromArrayList( ArrayList lines, int keyIndex)

Description

get Hash Map From Array List

License

Open Source License

Declaration

static public HashMap<String, String> getHashMapFromArrayList(
            ArrayList<String> lines, int keyIndex) 

Method Source Code

//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;
    }
}

Related

  1. getHashMap()
  2. getHashMap()
  3. getHashMap()
  4. getHashMap()
  5. getHashMap(Object... args)
  6. getHashMapFromMap( Map map, K key)
  7. hashMap()
  8. hashMap()
  9. hashmap()