Java Array to Map toMap(String[]... wordMappings)

Here you can find the source of toMap(String[]... wordMappings)

Description

to Map

License

Open Source License

Declaration

public static Map<String, String> toMap(String[]... wordMappings) 

Method Source Code

//package com.java2s;
/* Copyright c 2005-2012.
 * Licensed under GNU  LESSER General Public License, Version 3.
 * http://www.gnu.org/licenses//from   ww  w.ja  v a 2s .  co m
 */

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static Map<String, String> toMap(String[]... wordMappings) {
        Map<String, String> mappings = new HashMap<String, String>();
        for (int i = 0; i < wordMappings.length; i++) {
            String singular = wordMappings[i][0];
            String plural = wordMappings[i][1];
            mappings.put(singular, plural);
        }
        return mappings;
    }
}

Related

  1. toMap(K[] keys, V[] values)
  2. toMap(String... args)
  3. toMap(String... keysAndValues)
  4. toMap(String[] keyNames, T[] values)
  5. toMap(String[] keys)
  6. toMap(String[][] checksumsArray)
  7. toMap(String[][] strings)
  8. toMap(T[][] pairs)
  9. toMap(T[][] ts)