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.Map;

public class Main {
    /**
     * @author TheMrMilchmann
     * @since DerpieLang v1.0.0
     */
    @SuppressWarnings("unchecked")
    public static final <K, V, OK> HashMap<K, V> transform(Map<OK, ?> toTransform) throws IllegalArgumentException {
        HashMap<K, V> map = new HashMap<K, V>();

        try {
            for (Object key : toTransform.keySet()) {
                map.put((K) key, (V) toTransform.get((OK) key));
            }

            return map;
        } catch (Throwable t) {
            throw new IllegalArgumentException(t);
        }
    }
}