package hashmapper;
import java.util.HashMap;
/**
*
* @author Nurhak
*/
public class HashMapper {
private static HashMap hm = new HashMap();
private static String numbers[][] = {
{"1", "a"},
{"2", "b"},
{"3", "c"},
{"4", "d"},
{"5", "e"}
};
public static void findValue(String key) {
System.out.println("-->" + hm.get(key));
}
public static void main(String[] args) {
for (int i = 0; i < numbers.length; i++) {
hm.put(numbers[i][0], numbers[i][1]);
}
findValue("1");
findValue("3");
findValue("5");
System.out.println(hm);
}
}
import java.util.HashMap;
/**
*
* @author Nurhak
*/
public class HashMapper {
private static HashMap hm = new HashMap();
private static String numbers[][] = {
{"1", "a"},
{"2", "b"},
{"3", "c"},
{"4", "d"},
{"5", "e"}
};
public static void findValue(String key) {
System.out.println("-->" + hm.get(key));
}
public static void main(String[] args) {
for (int i = 0; i < numbers.length; i++) {
hm.put(numbers[i][0], numbers[i][1]);
}
findValue("1");
findValue("3");
findValue("5");
System.out.println(hm);
}
}
Comments
Post a Comment