Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;
import java.util.Map.Entry;

public class Main {
    public static <K, V> Map<K, V> map(Entry<K, V>... entries) {
        Map<K, V> map = new LinkedHashMap<>(entries.length);
        for (Entry<K, V> entry : entries) {
            map.put(entry.getKey(), entry.getValue());
        }
        return map;
    }

    public static <K, V> Map<K, V> map(Collection<Entry<K, V>> entries) {
        Map<K, V> map = new LinkedHashMap<>(entries.size());
        for (Entry<K, V> entry : entries) {
            map.put(entry.getKey(), entry.getValue());
        }
        return map;
    }
}