Java Map Create createMap(K k1, V v1)

Here you can find the source of createMap(K k1, V v1)

Description

create Map

License

Open Source License

Declaration

public static <K, V> Map<K, V> createMap(K k1, V v1) 

Method Source Code

//package com.java2s;
/**//from  www .ja  va2 s. c om
 * Copyright (C) 2015 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */

import java.util.Collections;
import java.util.HashMap;

import java.util.Map;

public class Main {
    public static <K, V> Map<K, V> createMap(K k1, V v1) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2, K k3, V v3) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        m.put(k3, v3);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        m.put(k3, v3);
        m.put(k4, v4);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        m.put(k3, v3);
        m.put(k4, v4);
        m.put(k5, v5);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6,
            V v6) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        m.put(k3, v3);
        m.put(k4, v4);
        m.put(k5, v5);
        m.put(k6, v6);
        return Collections.unmodifiableMap(m);
    }

    public static <K, V> Map<K, V> createMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6,
            K k7, V v7) {
        Map<K, V> m = new HashMap<>();
        m.put(k1, v1);
        m.put(k2, v2);
        m.put(k3, v3);
        m.put(k4, v4);
        m.put(k5, v5);
        m.put(k6, v6);
        m.put(k7, v7);
        return Collections.unmodifiableMap(m);
    }
}

Related

  1. createMap()
  2. createMap()
  3. createMap(boolean full)
  4. createMap(int len)
  5. createMap(Iterable> entries)
  6. createMap(K[] keys, V[] values)
  7. createMap(List keys, List values)
  8. createMap(List keys, List values)
  9. createMap(Map map)

  10. HOME | Copyright © www.java2s.com 2016