Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class Main {
    /**
     * Converts a list of string values to a map with the string value as both
     * key and value
     * 
     * @param stringValues
     * @return a Map
     */
    public static Map toMap(List stringValues) {

        Map map = new HashMap();
        for (Iterator iter = stringValues.iterator(); iter.hasNext();) {
            String value = (String) iter.next();
            map.put(value, value);
        }
        return map;
    }
}