Here you can find the source of listToMap(List input)
private static Map<String, Object> listToMap(List input)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static Map<String, Object> listToMap(List input) { int sz = input.size(); Map<String, Object> output = new LinkedHashMap<>(); for (int i = 0; i < sz; i++) { output.put("idx_" + i, input.get(i)); }//from w w w . j av a2 s .c o m return output; } }