戻り値の型がHashMapのメソッドを作る
メモ。
package com.practice001; import java.util.HashMap; public class ReturnHashMap { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ HashMap<String, Integer> hm = new HashMap<String, Integer>(); hm = CalledMethod(10); System.out.println(hm.get("para1")); System.out.println(hm.get("para2")); } public static HashMap<String, Integer> CalledMethod(int x){ HashMap<String, Integer> hm = new HashMap<String, Integer>(); hm.put("para1", x * 2); hm.put("para2", x * 3); return hm; } }