Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static <K, V> Map<K, V> zipMap(final List<? extends K> keys, final List<? extends V> values) {
        if (keys.size() != values.size()) {
            throw new RuntimeException("List's size must be equals!");
        }
        final int size = keys.size();
        final Map<K, V> out = new HashMap<K, V>();
        for (int i = 0; i < size; ++i) {
            out.put(keys.get(i), values.get(i));
        }
        return out;
    }
}