Here you can find the source of createMapFromList(List list)
Parameter | Description |
---|---|
list | a parameter |
public static HashMap createMapFromList(List list)
//package com.java2s; /*//from ww w. j av a2 s . c o m * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ import java.util.HashMap; import java.util.Iterator; import java.util.List; public class Main { /** * Simple List to HashMap creator * @param list * @return * @since 5.0 */ public static HashMap createMapFromList(List list) { HashMap hmap = new HashMap(list.size()); Iterator iter = list.iterator(); while (iter.hasNext()) { Object oTemp = iter.next(); hmap.put(oTemp, oTemp); } return hmap; } }