Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static <K, V> Map<K, V> listToMap(Object... objects) {
        HashMap map = new HashMap();
        Object key = null;
        for (final Object object : objects) {
            if (key == null) {
                key = object;
            } else {
                map.put(key, object);
                key = null;
            }
        }
        return map;
    }
}