Java Array to Map toMap(T[][] pairs)

Here you can find the source of toMap(T[][] pairs)

Description

to Map

License

Apache License

Declaration

private static <T> HashMap<T, T> toMap(T[][] pairs) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

public class Main {
    private static <T> HashMap<T, T> toMap(T[][] pairs) {
        HashMap<T, T> map = new HashMap<>();
        for (T[] pair : pairs) {
            map.put(pair[0], pair[1]);/*from   w  w w  . j a v  a  2 s .  c o  m*/
        }
        return map;
    }
}

Related

  1. toMap(String[] keyNames, T[] values)
  2. toMap(String[] keys)
  3. toMap(String[]... wordMappings)
  4. toMap(String[][] checksumsArray)
  5. toMap(String[][] strings)
  6. toMap(T[][] ts)