Here you can find the source of toStringArray(HashMap
Parameter | Description |
---|---|
syms | the input HashMap |
public static String[] toStringArray(HashMap<String, Integer> syms)
//package com.java2s; /**/*from www .j a v a2 s . co m*/ * * Copyright 1999-2012 Carnegie Mellon University. * Portions Copyright 2002 Sun Microsystems, Inc. * Portions Copyright 2002 Mitsubishi Electric Research Laboratories. * All Rights Reserved. Use is subject to license terms. * * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL * WARRANTIES. * */ import java.util.HashMap; public class Main { /** * Convert a HashMap to string array * * @param syms the input HashMap * @return the strings array */ public static String[] toStringArray(HashMap<String, Integer> syms) { String[] res = new String[syms.size()]; for (String sym : syms.keySet()) { res[syms.get(sym)] = sym; } return res; } }